Burkina Faso's interim president triumphantly returned to power Wednesday, a week after his political demise had seemed all but certain following a military coup.

In the days after the coup, the population showed it was prepared to take to the streets, similar action that forced the country's previous president to step down a year ago after nearly 30 years in power. This time people took to the streets of the capital, Ouagadougou, to protest against the elite presidential guard, which had seized power from the transitional government.

The national army also weighed in against the junta, dramatically massing its troops in the capital and threatening to forcibly disarm the coup plotters if necessary, underscoring a determination here to break with West Africa's history of frequent and destabilizing power grabs.

"In my opinion the heroes of Burkina Faso are the republican army who came to protect the protesters while putting pressure on the junta," said Philippe Hugon, Africa analyst for the French Institute for International and Strategic Affairs.

Last week's coup was led by members of the presidential guard still loyal to ex-President Blaise Compaore, who was ousted in an uprising in October 2014 after he angered people by attempting to prolong his 27-year rule. Coup leader Gen. Gilbert Diendere was unhappy that the transitional government had barred supporters of Compaore and his former ruling party from running for office in elections set for October.

But the military didn't back the coup by the presidential guards, long seen to have more privilege. The military stood closer to the general population, said Maggie Dwyer, a research fellow at the University of Edinburgh's Center for African Studies.

"The response by the population - especially given the history of the presidential guard and their abuses and that they were alleged to have killed numerous protesters in 2014 - that's where I would say this is exceptional," she said.

"Burkina Faso has always had a strong civil society compared to other countries in the region," Dwyer said, adding that the country has seen mass demonstrations since the 1960s.

Regional leaders followed suit. The Economic Community of West African States quickly passed a resolution calling for the coup leader to step down and for the transitional president to be reinstated. The quick regional response shows a determination by the regional leaders to keep West Africa stable, said Dwyer.

Faced with opposition from the rank and file military, popular unrest in the capital and firm opposition from regional leaders, coup leader Diendere said Tuesday that he would step down as requested by the regional bloc.

Several West African heads of state flew to Burkina Faso Wednesday to oversee the ceremony to reinstate the transitional government.

Interim President Michel Kafando and Prime Minister Yacouba Isaac Zida were met with cheers and the national anthem at the official handover ceremony Wednesday, a week after they had been arrested by members of the presidential guard.

"During this ordeal we have fought together and in freedom we triumph together," Kafando said in a declaration to the nation.

Now Kafando must organize elections to install a democratic government in Burkina Faso.

"It's important for people to see that the actions they took and put into place in 2014 (when Compaore was ousted) are carried through," said Dwyer.