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.
It comes a day after the presidential guard, who were behind the coup, signed a deal with the regular army to avoid violence.
They pledged to return to barracks and the army to withdraw from the capital.
The presidential guard (RSP) is loyal to Blaise Compaore, the country’s long-time ruler who was ousted in a popular uprising last year.
The elite troops installed Gen Gilbert Diendere as the leader last week – a month before elections had been due in the landlocked country.
The army on Monday ordered the coup leaders to step down or be ousted by force, raising the spectre of a civil war.
At least 10 people have been killed and more than 100 injured in clashes between the RSP and protesters.
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.
Benin’s President Thomas Boni Yayi, at the ceremony, said efforts must now be focused on efforts to quickly bring free, fair and transparent elections.
It is not clear whether the mediators’ peace plan includes key RSP demands for an amnesty for the coup leaders and the lifting of an electoral ban on those connected to Mr Compaore.
Earlier on Wednesday, Mr Kafando said he was not fully committed to the plan, put together on Tuesday by West African presidents at an emergency meeting of the regional bloc Ecowas.
“We are proud of the mobilisation and fearlessness of the people of Burkina Faso, in particular of its youth, whose determination has stopped” the coup succeeding, Mr Kafando said.
“I salute the international community for having rejected unequivocally this action…
“Regarding the Ecowas proposals for a solution to the crisis, it is obvious that we will only commit to them if they take into account the will of the Burkinabes.”
He had been detained during a cabinet meeting last Wednesday.
The agreement overnight between the RSP and army was signed in front of the country’s most influential leader, Mogho Naba.
Regular army troops had entered Ouagadougou on Monday vowing to retake it.
The deal ended the 24-hour stand-off and defused the tension ahead of the African leaders’ visit.