March 17 (Reuters) - Madagascar's President Marc Ravalomanana's handover of power to the armed forces paves the way for opposition leader Andry Rajoelina to take office and end months of violent power struggle.* Key to future peace will be whether the army maintains a united stance. The decision by officers to get off their traditionally neutral fence and side with Rajoelina was the tipping point that ultimately isolated the president.* So far, the signs are positive for stability. Military heads are to back Rajoelina en masse and reject the idea of military government -- a position they have always maintained.* While the immediate danger of civil war seems to have been avoided, some in the ranks supported Ravalomanana to the end. But the military appears to be quashing dissent for now.* When Rajoelina is installed, he faces major challenges at home and abroad. His power base is mainly in the capital and if he is deemed to have won power through a military coup, he may be ostracised by the international community.* International groups such as the European Union and the African Union are united in their condemnation of non-democratic changes of government and can impose sanctions, or cut development aid to offenders -- even though some African Union members have questionable democratic records themselves.* Ravalomanana's decision to resign, rather than fight to the end, could help the opposition and mute condemnation. If Rajoelina can convince donors he is serious about democracy and hold elections as promised, he may be able to finesse the international reaction.* There is huge foreign interest in Madagascar from mining and oil firms and plenty of money to be made from tourism, if the country is stable. Dragging much of the population out of poverty is going to be another major challenge for a new leader.* New mines being developed in Madagascar are far enough from the capital to have been untouched by the disturbances since the start of the year, but continuing uncertainty would discourage new investment as the world economy slows.* First, though, Rajoelina would need to change the law. At 34, he's too young to be president. Opposition officials say they plan to re-write the constitution and electoral code and hold elections within 24 months.
Leadership in Madagascar is unclear as Madagascan President Marc Ravalomanana announced his resignation in favor of a military committee headed by Vice Admiral Hyppolite Ramaroson, only to have that resignation rejected by the Admiral, the military and opposition political groups. Admiral Ramaroson joined other military leaders in saying they would back opposition leader, former Antananarivo mayor and former DJ Andry Rajoelina.

Mr Ravalomanana attempted to hand power over to the heads of the military, given the tasks of discussing and drafting constitutional changes, rather than transfer power to Mr Rajoelina. After the resignation was announced to the opposition, four Army generals and a head of the church were detained for reasons unknown. The true extent of the Army's loyalty to Mr Rajoelina is unclear, as reportedly the military refused to arrest President Ravalomanana despite orders from Mr Rajoelina.

Mr Rajoelina installed himself in the Presidential Palace in upper Antananarivo, which troops had seized yesterday. A cabinet loyal to him has been in operation since the end of January, when Mr Rajoelina proclaimed Mr Ravalomanana's rule to be illegitimate. The Madagascan opposition accuses Mr Ravalomanana of mismanaging the country while restricting personal freedoms.

President Ravalomanana was reportedly first announced via an text message from one of his aides before being confirmed by Ravalomanana's office in a radio broadcast, in which the President proclaimed, "After deep reflection, I have decided to dissolve the government and give up power so that a military directorate can be established". Madagascan Army Chief of Staff Colonel Andre Ndriarijaona has declared his support for Rajoelina and says that "99% of the forces are behind" the opposition leader.
Eco-tourists visit Madagascar to see its unique wildlife. 
The African Union, meanwhile, reiterated its position that a military takeover in Madagascar would be considered a coup d'etat, which could result in "firm measures" such as Madagascar's suspension from the organization or a blocking of international aid, and urged the military to obey the country's constitution, which bars Mr Rajoelina from the presidency due to his age, and not hand power over to the former mayor, instead suggesting that power could be given to Madagascan Prime Minister General Charles Rabemananjara. Members of the Madagascan opposition say they plan to re-write the constitution and electoral code before holding new elections within two years.

While reports are that the country has been overall stable during the coup, the unrest of the past two months has deprived the country of tourist revenue. Tourism, especially eco-tourism highlighting the country's rainforests and unique mammal species, brings $800 million annually to the Madagascan economy.