ANTANANARIVO (Reuters) - A former president of Madagascar and the man who ousted him in a 2009 coup competed to become the island state’s next leader in a run-off election on Wednesday.

Slideshow ( 8 images )

Madagascar is hoping for a second peaceful election since the political chaos that erupted when Marc Ravalomanana was forced out of office by protests led by Andry Rajoelina, who went on to take the top job.

“I hope that the next president of the republic will bring the development for the country, bring security and allow the children’s education,” said 21-year old student Haja Hasina after voting.

Both Rajoelina and Ravalomanana promised to put the past behind them when they entered the race, and both said they would accept the result as they cast their ballots in the capital, Antananarivo.

“Even if it is a rainy season, the sun is shining today. I hope the sun shall shine on Madagascar,” Rajoelina said.

“In case of vote rigging, it won’t be from our side, I am a democrat and if I lose I will accept the decision,” he added.

Ravalomanana said he was confident he could change the country. “Of course, I will accept the results. But obviously there should be respect to laws of the game.”

Soldiers were deployed across the island to ensure security during the polls, said the minister of defense.

“I call on the Malagasy to defend their choice, not to let the two candidates and their supporters do the job, come and vote and then assist and monitor the counting of votes,” the minister, General. Beni Xavier Rasolofonirina, said.

Rajoelina’s takeover in 2009, denounced as a coup by the African Union and other international bodies, scared off foreign investors and led donors to freeze funds.

Bending to international diplomatic pressure, Rajoelina gave up power in 2013, opening the way for Hery Rajaonarimampianina to win the presidency in elections later that year.

In the first-round election this November, Ravalomanana got 35.35 percent of the vote and Andry Rajoelina got 39.23 percent, both ahead of Rajaonarimampianina who came a distant third.

Provisional results in the run-off are expected before the end of the year.