Burkina Faso's interim President Michel Kafando, who was taken hostage during a coup a week ago, said he was back in power and had restored a civilian transitional government.
"I have returned to work," he said in a brief speech to journalists at the foreign ministry in the capital on Wednesday. "The transition is back and at this very minute is exercising the power of the state."
Burkina Faso coup leaders agreed to return to their barracks, signing a deal with the army that apparently defused the standoff sparked by last week's coup.
IN PICTURES: Burkina Faso coup and violent protests
The breakthrough came on Tuesday night after marathon talks in Nigeria's Abuja, where West African heads of state had sought to break the impasse fuelled by angry threats on both sides.
The deal was signed a day after troops entered Burkina's capital of Ouagadougou, turning up the pressure on the elite presidential guards (RSP), who staged the coup.
Under its terms, the RSP agreed to step down from the positions they had taken up in Ouagadougou, while the army also agreed to withdraw its troops 50km from the capital and guarantee the safety of the RSP members as well as their families.
The deal was presented to the Mogho Naba, or "king" of Burkina Faso's leading Mossi tribe, in front of the media early Wednesday.
Burkina Faso plunged into crisis last Wednesday when the powerful RSP detained the interim leaders who had been running the country since a popular uprising deposed iron-fisted President Blaise Compaore last October.
The elite unit of 1,300 men loyal to Compaore officially declared a coup on Thursday and installed rebel leader General Gilbert Diendere, Compaore's former chief of staff, as the country's new leader.
In a statement on Tuesday, the Economic Community of West African States said it planned to reinstate and demonstrate solidarity with Kafando, who was released on Friday.