One day after troops stormed his official residence, bringing a two-month long power struggle to the boil, MadagascarPresident Marc Ravalomanana has stepped down and handed over power to the military. He is holed up in a palace on the outskirts of the capital Antananarivo, along with members of his presidential guard.

His rival, Andry Rajoelina, a former DJ turned opposition firebrand, is behind what the African Union has called an illegal coup. On Tuesday, he installed himself in the hilltop presidential compound and said he had fired several government ministers.

Last week, the country’s Army chief was ousted and his successor quickly joined forces with Mr. Rajoelina. Since January, Rajoelina has led waves of often violent protests against Mr. Ravalomanana, whom he accuses of corruption and mismanagement. On Monday, in a desperate last stand, the president proposed holding a referendum to decide who should rule the country. But that was quickly overtaken by events on the ground.

Opposition officials said Rajeolina would lead a transitional authority, and that they would organize elections and rewrite Madagascar's Constitution, reportedReuters. The current Constitution stipulates that Madagascar's president must be at least 40, while Rajeolina is 34.

It is an ignoble exit for Ravalomanana, who came to power in 2001 and faced a similar standoff with another rival for the job. The two men both claimed victory in presidential polls and attempted to govern for several months before Ravalomanana's rival went into exile.

Madagascar, a former French colony of 20 million people, is a poor Indian Ocean island with a small tourist industry centered on its unique wildlife, including dozens of species of lemurs. In recent years, foreign mining companies have begun prospecting and extracting resources, bringing in much-needed foreign currency.

Ravalomanana made his fortune as a businessman and owns the largest dairy company in Madagascar. He built a support base in rural areas, but voters in Anatanarivo have soured on his presidency since a strong reelection victory in 2005.