BISSAU (Reuters) - Former prime minister and ex-army general Umaro Cissoko Embalo has won Guinea-Bissau’s presidential vote, the electoral commission said on Wednesday, but his opponent complained of fraud and vowed to contest the result in court.

Embalo, 47, won with 54% of Sunday’s vote, the commission said, versus 46% for another ex-prime minister and ruling party candidate Domingos Simoes Pereira in the poll to succeed incumbent President Jose Mario Vaz.

Vaz’s tenure was marred by political infighting, an ill-functioning parliament and corruption.

If Pereira’s challenge fails, Embalo, who served as prime minister under Vaz from 2016-18, faces the difficult task of overcoming a long-running political impasse and modernizing the West African nation of 1.6 million people.

Guinea Bissau has seen nine coups or attempted coups since independence from Portugal in 1974.

“I call for union, reconciliation and concord for a peaceful life in Guinea Bissau,” Embalo told a press conference on Wednesday in which he also promised to revive the education and energy sectors. “We must believe in ourselves and put ourselves to work to create wealth and develop the country.”

However, Pereira’s complaint looks set to extend the political chaos that has dogged the tiny ocean-side country in recent years and made voters weary of the political class.

The 56-year-old, who easily won a November first round, told supporters that in some polling stations votes surpassed the number of enrolled voters and he would file a complaint to the Supreme Court.

“There has been an infringement of the electoral truth and the most legitimate rights of the people of Guinea Bissau,” he said.

Embalo’s candidacy gained support from the main contenders who failed to reach the run-off, including Vaz.

The announcement of his victory sparked celebrations in the capital Bissau, which has remained calm and optimistic during an election many hoped would draw a line under weeks of turmoil including violent protests, an alleged coup attempt and the emergence of two competing prime ministers.

“We voted for Embalo for change,” said Kady Gassama, a 38-year-old cleaner. “We voted to bring the country out of the economic, political and social crisis.”

The next president also faces widespread poverty and an unstable political system in which the majority party appoints the government but the president can dismiss it.

There have been seven prime ministers since Vaz took over in 2014 and instability has hurt the economy, which depends heavily on volatile prices for cashew nuts, the main income source for more than two thirds of households.

Traffickers also exploit Guinea-Bissau’s unpoliced waters and maze of picturesque forested islands to ship South American cocaine destined for Europe.