LIBREVILLE, Gabon — Gabon’s president has narrowly won re-election, election officials said Wednesday, keeping alive a family dynasty in this oil-rich Central African country that reaches back to the 1960s. Clashes quickly broke out in the capital as opposition supporters claimed election fraud, looting and burning buildings.

President Ali Bongo Ondimba beat leading opposition candidate Jean Ping by just 1.57 percentage points, setting the stage for an almost certain challenge to the results.

Flames and smoke rose in the night sky from a large fire set to cars on a street in front of the National Assembly, according to residents nearby, who said that by late in the evening people had left the streets.

Demonstrators in several other districts vandalized a mall, looted a bank and burned buildings, including one belonging to the vice prime minister, witnesses said.

Police had earlier fired tear gas at hundreds of opposition activists who converged near the Constitutional Court in the capital, Libreville, as army helicopters flew overhead.

Looting and clashes also followed Bongo’s win in 2009, when he came to power after the death of his father, longtime ruler Omar Bongo.

Bongo won this election with 49.8 percent of the vote, while Ping had 48.23 percent. The constitutional court must finalize the electoral commission’s provisional results.

The results came a day later than expected, prompting fears of a tainted process.

European Union observers criticized a “lack of transparency,” and the EU called for the electoral commission to publish the results from all polling stations.

France and the United States also called for individual polling station results to be published. The U.S. Embassy said voters were not “well-served by the many systemic flaws and irregularities that we witnessed,” including the late opening of polling stations and “last-minute changes to voting procedures.”

U.N. Secretary-General Ban Ki-moon urged political leaders and their supporters “to refrain from further acts that could undermine the peace and stability of the country” and urged security forces to “exercise maximum restraint in response to protests,” his spokesman said.

Ban also called on political leaders “to address any disputes they may have through existing constitutional and legal channels,” spokesman Stephane Dujarric said.

The secretary-general is sending his special representative for central Africa, Abdoulaye Bathily, to Gabon to help in efforts to “calm the situation and to peacefully resolve the contentious issues emanating from the electoral process,” Dujarric said.

The U.S. State Department also urged calm and encouraged security forces to “act with both restraint and respect for the human rights of all Gabonese citizens.”

Bongo, in a statement after his victory, congratulated everyone for voting in peace and transparency. “We are living in a moment where we must be more solid and more strong together,” he said.