Marc Ravalomanana and Andry Rajoelina will contest second round election on December 19, country’s top court says.

A former president of Madagascar and the man who overthrew him in a coup will compete to become the island state’s next leader in December after the two came top in a first-round vote that knocked out the incumbent.

Former President Marc Ravalomanana received 35.35 percent of the vote in the November first round, behind his successor, Andry Rajoelina, who got 39.23 percent, the High Constitutional Court said on Wednesday.

Current President Hery Rajaonarimampianina received just 8.82 percent, the court said, and will not take part in the second round. The court rejected his request to have the election cancelled.

The runoff vote is set for December 19.

It is the first time the bitter rivals have faced each other at the ballot box.

Both Ravalomanana, 68, and Rajoelina, 44, were banned from running in the last election in 2013 under international pressure to avoid a repeat of deadly political violence that engulfed the island in 2009.

Ravalomanana ruled from 2002 to 2009, until he was overthrown in a military-backed coup that installed Rajoelina, who was in power until 2014.

The court said total voter turnout was 53.95 percent of the registered voters.

‘Avoid provocations’

Judge Rakotoarisoa cautioned the two hopefuls to “avoid provocations” as they head to the final stretch of the election in a country which has a history of political turmoil.

“The people of Madagascar do not need trouble,” he said, warning that there should be no vote rigging.

Rajoelina, who sat in the court on Wednesday, had lodged complaints alleging that election officials tampered with software to “inflate” the number of registered voters in the first round in what he labelled “vote manipulation”.

He had also accused Ravalomanana of vote buying.

The electoral commission rejected the allegations and the court threw out his petition.

Last week, Ravalomanana withdrew his legal complaints about alleged irregularities in the first round, with his lawyer saying the decision was reached for the sake of “peace and sovereignty of Madagascar”.

Shortly after the court session on Wednesday, Rajoelina vowed to appeal to undecided voters.

“I open my arms, let’s work together to save Madagascar,” he said.

“I will do my best to convince the undecided,” Rajoelina told reporters.

Madagascar is well known for its vanilla and precious redwood, yet is one of the world’s poorest countries, according to the World Bank data, with almost four in five people living in poverty.

In the largely peaceful campaign in the lead up to the first round of the election, the frontrunners spent huge sums on flashy rallies and helicopters, with 36 candidates in all.

The former French colony off the southeastern coast of Africa also has a long history of political instability and coups.