Madagascar's electoral court has declared Hery Rajaonarimampianina president-elect despite allegations by his defeated rival that the December run-off vote was rigged.
The ruling on Friday raises the spectre of protests by supporters of Jean Louis Robinson who had demanded a recount and warned on Thursday that his patience was wearing thin.
"I urge goodwill from everyone so that we can build a prosperous and stable nation," said Rajaonarimampianina, who was backed by the outgoing president, Andry Rajoelina, who spearheaded the 2009 coup.
Rajaonarimampianina, former finance minister in the government set up in 2009, was "declared officially president of the Republic of Madagascar," said court president Francois Rakotozafy.
Any prolonged row over the result of the Dec. 20 vote, the first since a coup on the Indian Ocean island in 2009, threatens to extend a political crisis that has sharply slowed economic growth and deepened poverty.
We will only stop when Jean Louis Robinson is installed as president.
An aide to Robinson, who was backed by Marc Ravalomanana, the man ousted from power five years ago, this week said he would outline the "irregularities" to the Southern African Development Community and African Union.
Both blocs had worked on a political deal to push Madagascar towards an election.
The electoral court said Rajaonarimampianina won 53.5 percent of the vote to Robinson's 46.5 percent, confirming the electoral commission's provisional results.
Robinson's ally, Roland Ravatomanga, a minister in the power-sharing government, said: "We will only stop when Jean Louis Robinson is installed as president."
The vote was meant to end a crisis that has driven out investors, cut aid flows and led to Madagascar's diplomatic isolation.
The streets of the capital Antananarivo, where Rajaonarimampianina had struggled to win support in the first round, were calm after the court's announcement, though some fretted about the risk of unrest.
"I'm worried," said teacher Noro Ravaonirina. "Recently there's been a talk, for right or wrong, about vote rigging. In such an environment you can't exclude that the loser won't accept his defeat easily."