Burkina Faso's toppled interim President Michel Kafando has resumed power after a week-long coup by renegade troops, who caved in under pressure from regional powers and former colonial ruler France.
The move came after marathon talks in the capital of regional and military heavyweight Nigeria, brokered by the ECOWAS west African regional bloc, and threats by French President Francois Hollande that the coup leaders could face sanctions if they did not hand back power.
"The transition has been restored and this very minute I am resuming the exercise of power," Kafando told reporters.
Six ECOWAS heads of state were meanwhile arriving in the Burkinabe capital Ouagadougou to oversee the formal reinstallation of Kafando and to try and sort out two contentious issues: an amnesty plan for the putschists and whether upcoming elections should be open to supporters of previously deposed veteran dictator Blaise Compaore.
Kafando said the regional leaders would "take into account the will of the Burkinabe people" in their new mediation bid.
The deal to restore the interim administration to power was signed overnight after troops entered Ouagadougou, turning up the pressure on the elite presidential guards (RSP) who staged the coup.
Under its terms, the RSP agreed to stand down from the positions they had taken up in Ouagadougou, while the army also agreed to withdraw its troops and guarantee the safety of the RSP members as well as their families.
The accord was presented to the Mogho Naba, "king" of Burkina Faso's leading Mossi tribe, in front of the media early on Wednesday (local time).
Burkina Faso was 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 Compaore last October after his failed bid to extend his 27-year rule.
The elite unit of 1300 men loyal to Compaore officially declared a coup and installed rebel leader General Gilbert Diendere, Compaore's former chief of staff, as the country's new leader.
The breakthrough came as Diendere told AFP that interim president Kafando, who had been seized by presidential guards but later released, would be returned to office on Wednesday.
The putsch came just weeks ahead of an election planned for October 11, with at least 10 people killed and more than 100 injured in the unrest.