(CNN) -- Madagascar's military handed over the reins of the island nation to opposition leader Andry Rajoelina on Wednesday, ending a two-month long political crisis -- but apparently creating a constitutional one.
Andry Rajoelina is six years too young to be Madagascar's president under its constitution.
Rajoelina, a former disc jockey turned mayor of Madagascar's capital, declared himself president of a transitional government and his supporters pledged to hold elections in two years.
But Rajoelina, at 34, is six years too young to be president, according to the country's constitution.
Also, the constitution says the head of parliament's upper house must call elections within two months if something happens to the president.
Madagascar's former president, Marc Ravalomanana, ceded power to his military Tuesday after insisting over the weekend that he would remain in control.
Analysts think Ravalomanana had little choice but to step down once he had lost much of the army's support.
The African Union had warned that any power transfer aided by the military would amount to a coup d' etat.
The Union has since removed any mention of a coup in its official communique and called on the transitional government to "comply scrupulously with the provisions of the constitution of Madagascar on interim arrangements."
Monja Roindefo, the opposition-appointed prime minister, vigorously defended the week's developments on the island, located off the southeastern coast of Africa.
"Well, we would like to define what is a coup," he told CNN on Wednesday. "A coup is a group of people or persons who takes the power on behalf of sovereignty, on behalf of the people ... when the representative democracy doesn't work anymore."
"As you know, as stated, in the African Union charter, the people have the right to defend itself from an oppression or a dictatorship in Africa," he added.
Roindefo said the new government will hold elections but has given itself two years to clean up the process. Watch more from iReporters and Twitterers on the crisis »
"How could you make an election immediately?" he said. "We need to reform the electoral commission. ... So the 24 months that we have given ourselves is to prepare all these types of elections in order to build a genuine democratic country."
The African Union also asked that all steps be taken to ensure the safety of the former president. The opposition leader had called for Ravalomanana's arrest, accusing him of corruption, financial mismanagement and dictatorship.
Ravalomanana was first elected in 2001 and won a second term in 2006. To many Malagasy, he represented a new breed of politician -- a self-made millionaire, a no-nonsense business leader.
But Ravalomanana maintained his business empire while in office and it was unclear to many where his business interests ended and his political leadership began. His recent purchase of a $60 million airplane further stoked public discontent.
Opposition leader Rajoelina was quick to seize on the sentiments and made fiery appeals to the country's impoverished masses.
The country was plunged into political instability in January after thousands of people took to the streets to protest rising food prices and what they perceived as autocratic behavior by Ravalomanana.
The protests soon degenerated into rioting and looting, and left about 100 people dead. Watch more on president's resignation »
Soon after, Rajoelina declared that he was in charge of the country. He gave Ravalomanana until early February to step down.
The president responded by firing Rajoelina as mayor of the capital, inciting the latter's supporters to once again descend on the streets. More deadly violence followed.
Clashes spread to most provincial capitals and other cities across the country, with homes and businesses looted and burned, the U.S. State Department reported.
CNN's David McKenzie contributed to this report.
All About Madagascar