Military leaders in Madagascar have conferred full powers on 34-year-old opposition leader Andry Rajoelina, hours after the president resigned.
The officials said they had rejected an invitation from President Marc Ravalomanana to take up power as a military directorate.
Mr Rajoelina earlier installed himself in the president's offices, seized on Monday by pro-opposition troops.
He announced a new constitution and elections within two years.
The BBC's Jonah Fisher in the capital, Antananarivo, says that after a day of confusion the military seems to have given clear backing to Mr Rajoelina, apparently resolving a long power struggle on the Indian Ocean island.
The African Union had urged the army not to hand power to Mr Rajoelina, saying this would amount to a coup.
Mr Rajoelina has led protests against Mr Ravalomanana that began in January. The crisis has left more than 100 people dead.
Speaking at a military camp in the capital late on Tuesday, Vice Adm Hyppolite Ramaroson said the military was giving full powers to Mr Rajoelina "to become president of the high transitional authority".
"We have categorically rejected the [military] authority that [Mr] Ravalomanana asked us to set up after his resignation," he said.
Mr Ravalomanana had said he was handing over to the military during a radio address in which he announced his resignation.
He said he had decided to give up power after "deep reflection".
"This decision was very difficult and very hard, but it had to be made," he said. "We need calm and peace to develop our country."
His decision to cede power marks a dramatic victory for Mr Rajoelina, who was sacked as mayor of the capital in February.
The former disc jockey took up office at the presidential residence in central Antananarivo on Tuesday before emerging triumphantly to parade among thousands of supporters.
"I accept humbly and with love - I assume as a duty - all responsibility, management and leadership of our beloved country, Madagascar," he said.
He also announced that the constitution would be changed - the current constitution sets a minimum age of 40 for presidential candidates, while Mr Rajoelina is 34.
Earlier, a number of government ministers quit, as power ebbed away from the president.
Our correspondent says the mood on the streets was one of relief following fears of a bloody last stand if Mr Ravalomanana had continued to cling to power.
Mr Ravalomanana had said he was ready to fight to the death at the Iavoloha palace, about 15km (nine miles) from the city centre.
It was not clear whether Mr Ravalomanana was still in the palace late on Tuesday.
UN Secretary General Ban Ki-moon expressed grave concern at the unrest in Madagascar, appealing to all parties to ensure a "smooth transition".
The African Union and the Southern Africa Development Community (SADC) had condemned in advance any direct seizure of power by Mr Rajoelina.
"We don't think anybody has the right to unseat an elected government by force," Botswanan Foreign Minister Phando Skelemani told the BBC, speaking on behalf of SADC.
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 seized the central bank.
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.