Madagascar's President Marc Ravalomanana has said he is standing down and handing power to the military.
But military leaders were reported to favour a transfer direct to opposition leader Andry Rajoelina.
Mr Rajoelina, who has led weeks of protests, had earlier installed himself in the president's offices, seized on Monday by pro-opposition troops.
Mr Ravalomanana has reportedly left the Iavoloha palace on the fringes of the capital for an undisclosed location.
The crisis on the Indian Ocean island has left 100 people dead since January.
The BBC's Jonah Fisher in the capital Antananarivo says although it seems clear that Mr Ravalomanana is stepping down, there is some confusion over how it will be done.
In a radio address announcing his resignation Mr Ravalomanana said an unnamed general had turned down an offer to take over and advised people to carry on listening to broadcasts.
A spokesman for Mr Ravalomanana told Reuters news agency power had been handed to the most senior figure in the military, navy admiral Hyppolite Ramaroson.
But Col Andre Ndriarijaona, who last week said he had replaced the military chief of staff, said the military preferred Mr Rajoelina.
Mr Ravalomanana's resignation marks a dramatic victory for Mr Rajoelina, who was sacked as mayor of the capital in February.
The 34-year-old former disc jockey took up office at the presidential residence in central Antananarivo on Tuesday before emerging triumphantly to parade among thousands of supporters.
He has announced there will be a new constitution and elections within 24 months.
The current constitution sets a minimum age of 40 for presidential candidates.
Our correspondent says the mood on the streets is one of relief as there had been fears of a bloody last stand if Mr Ravalomanana had continued to cling to power.
Earlier, a number of government ministers quit, as power ebbed away from the president.
Mr Ravalomanana had said he was ready to fight to the death at the Iavoloha palace, about 15km (nine miles) from the city centre.
On Monday, Mr Rajoelina, who has declared himself president, rejected Mr Ravalomanana's offer of a referendum to solve the crisis and called for his arrest.
Later that day, troops stormed the presidential residence in the centre of the capital and also seized the central bank.
The African Union on Monday condemned the events in Madagascar "attempted coup d'etat".
Mr Ravalomanana was re-elected for a second term in office in 2006 and under him, Madagascar's economy has opened up to foreign investment, particularly in mining.
But 70% of the 20 million population still lives on less than $1 (£0.7) a day and correspondents say the opposition has tapped into popular frustration at the failure of this new wealth to trickle down.
Mr Rajoelina had said the president has been a tyrant who misspent public money but Mr Ravalomanana's supporters said his rival is a young troublemaker who has not offered any policy alternatives.