ANTANANARIVO, Madagascar - Madagascar's top generals handed over control of this Indian Ocean island nation to the opposition leader on Tuesday, hours after the president himself stepped down and tried to put the military in charge.
In a ceremony broadcast from a military camp in the capital, Vice-Admiral Hyppolite Rarison Ramaroson said he and two other generals rejected President Marc Ravalomanana's attempt to transfer power to a military directorate.
Instead, Ramaroson said the military was installing the president's bitter rival, opposition leader Andry Rajoelina, as the country's leader.
For months, Rajoelina - a disc jockey turned broadcasting magnate who had been mayor of Antananarivo, the capital - has been leading anti-government rallies and pressing Ravalomanana to step down. Some protests have led to deadly clashes.
He accused Ravalomanana of misspending public funds and undermining democracy in Madagascar - an impoverished nation off the coast of southeastern Africa known for both its natural beauty and its political instability.
Over the weekend, Rajoelina declared himself president of a transitional government and promised new presidential elections within two years. On Monday, he called on the army to arrest the president, but soldiers refused.
After weeks of insisting he would never resign, Ravalomanana announced Tuesday afternoon he was ceding control to the military. Almost as he spoke, Rajoelina was parading triumphantly through the capital surrounded by armed soldiers and an adoring crowd after seizing control of one of the city's presidential palaces.
Rajoelina told the French television station LCI he had the support of "soldiers, government workers, unions, that is to say all the country's key groups."
"Power belongs to the people," Rajoelina said. "The people give power, the people can take it back."
Norbert Lala Ratsirahonana, former chief of the constitutional court, acted as master of ceremonies for the military announcement, lending the move legitimacy even though Rajoelina, at 34, is too young to be president according to the constitution.
Ravalomanana claimed his rival sought power by unconstitutional means.
Ravalomanana's rags-to-riches tale - he started out selling ice cream from a bicycle - was once a source of popularity. But Rajoelina, tapping into the deep dissatisfaction of Madagascar's impoverished majority, portrayed Ravalomanana as interested mostly in enriching himself and out of touch with the suffering of ordinary people.
Rajoelina, however, comes from the wealthy minority that has had a stranglehold on Madagascar's politics.
Political tensions have been rising since late January, when the government blocked an opposition radio station's signal. Rajoelina supporters set fire to a government broadcasting building as well as an oil depot, a shopping mall and a private TV station linked to Ravalomanana. Scores of people were killed.
Days later, soldiers opened fire on anti-government protesters, killing at least 25. The incident cost Ravalomanana much of the support of the military, which blamed him for the order to fire.
Despite losing support at home, Ravalomanana had been backed by the international community because he was the democratically elected president.
U.N. Secretary-General Ban Ki-moon is "gravely concerned about the evolving developments in Madagascar," associate spokeswoman Marie Okabe said at U.N. headquarters in New York.
According to African Union rules, coups or unconstitutional changes of government are cause for automatic suspension from the bloc. The country is only readmitted when constitutional order is restored, usually by elections.
Madagascar is scheduled to host this year's AU summit in June or July, but could not do so if it were suspended.
Ravalomanana had warned that his desperately poor country could lose international aid if Rajoelina was allowed to take over.