Burkina Faso’s interim President Michel Kafando has been formally reinstated a week after the military takeover.
The ceremony took place in the capital, Ouagadougou, in the presence of several West African leaders who helped mediate an end to the crisis.
The presidential guard carried out the coup. Its leader Gen Gilbert Diendere admitted to local media that it had been “the biggest mistake”.
“We knew the people were not in favour of it. That is why we have given up.”
The presidential guard (RSP) is loyal to Blaise Compaore, the country’s long-time ruler who was ousted in a popular uprising last year.
They pledged to return to barracks after signing a deal with the regular army on Tuesday to hand back power. The army said it would withdraw from the capital.
Gen Diendere greeted arriving African leaders at the airport earlier on Wednesday, along with the army chief of staff, but did not attend the transfer of power ceremony.
He told reporters hours after Mr Kafando was reinstated that he took “full responsibility” for the coup and was “not afraid to face justice”.
He said he was happy that “we avoided confrontation” but admitted the coup had been a “waste of time and resources… and human lives were lost”
The BBC’s Maud Jullien in Ouagadougou says President Kafando thanked the West African leaders, to cheers from the audience of politicians and civil society leaders.
They put together a plan to end the crisis at an emergency meeting of the regional bloc Ecowas on Tuesday.