In this image taken from a video, Gambia’s new president, Adama Barrow, is interviewed by the Associated Press in Dakar, Senegal, on Jan. 21, 2017. (AP)

More than 22 years after taking power and a month after a shocking election defeat, Gambia’s president agreed to step down Saturday morning. 

Yahya Jammeh announced on state television in the tiny West African country he had ruled since taking power in a 1994 coup that he would “relinquish the mantle of this great nation.” 

The announcement did not come readily from one of the world’s most tempestuous leaders, who was defeated last month by Adama Barrow, a little-known former real estate agent.  

For weeks, Jammeh appeared unwilling to step down, even as several African leaders pleaded with him during visits to Gambia’s capital, Banjul. Barrow fled to neighboring Senegal for his safety. He was inaugurated in a small ceremony there Thursday.  

But as a bloc of West African nations massed 7,000 troops to the north and south of Gambia, threatening to enter and oust Jammeh by force if he did not leave willingly, the longtime leader finally announced his departure. As of Saturday evening, he remained in Banjul, but Barrow said Jammeh would be leaving shortly for Guinea.  

It was a crucial moment for Gambia and the regional coalition that had succeeded in getting Jammeh to step down. While many African leaders have recently sought ways to extend their terms, often by amending their countries’ constitutions, the Economic Community of West African States, known as ECOWAS, offered an example of how to enforce the electoral processes of its members.  

But the decision to remove Jammeh was also a testament to his unpopularity in the region. He had long made bizarre declarations, touting his ability to cure AIDS with local herbs, and threatening to personally slit the throats of all gay men living in his country. He also did little to engage neighboring leaders diplomatically.  

The “consensus on his removal stems from the fact that Jammeh’s been a bad neighbor for a long time, and his fellow heads of state are more than happy to see him go,” said Gregory Mann, a professor at Columbia University specializing in West African history. 

Senegalese President Macky Sall has for years accused Jammeh of offering a haven to members of a small separatist movement fighting for the independence of northern Senegal’s Casamance region.  

As Barrow prepared to assume power, many Gambians wondered whether he would try to prosecute his predecessor, who has been accused of human rights abuses by international and local civil society organizations. 

In a 2016 report, Human Rights Watch said Jammeh’s government “frequently committed serious human rights violations including arbitrary detention, enforced disappearance, and torture against those who voiced opposition to the government.” 

Jammeh has previously denied such accusations. But during the negotiations that led to his stepping down, he asked for amnesty from any crimes he might have committed during his rule, according to Marcel Alain de Souza, chairman of ECOWAS. That request was rejected.

On Saturday, Barrow told the Associated Press that he could not rule out the possibility that Jammeh could face trial in the International Criminal Court. 

“We aren’t talking about prosecution here. We are talking about getting a truth and reconciliation commission,” Barrow told the news agency. “Before you can act, you have to get the truth, to get the facts together.” 

Jammeh announced last year that Gambia would leave the international court, which his administration mocked as the “international Caucasian court.” But that decision wouldn’t take effect until later this year, and Barrow has said that he opposes the withdrawal. 

 Barrow will find himself under significant pressure to reorient Gambia’s fledgling judicial system and a poorly performing economy that led many citizens to seek employment abroad. Last year, Gambia was the fifth-largest source of refugees in all of Africa, according to the International Organization for Migration, despite having one of the continent’s smallest populations. 

Barrow will also have an opportunity to repair relations with the West African nations that Jammeh had alienated in recent years. 

“Most crucially, it ought to mean much better relations with Senegal,” Mann said. 

Gambia is entirely surrounded by Senegal, except for its Atlantic coastline. 

 As they waited for Jammeh to depart the state house, Gambians were left to wonder about the details of the deal that led to his concession. Where would he go? Would he try to insulate himself from prosecution? 

One of the negotiators offered a few details.

 “The accord sees the departure of Jammeh from Gambia for an African country with guarantees for his family, those close to him and himself. He can come back to the country as he pleases,” Mauritanian President Mohamed Ould Abdel Aziz told his country’s state news agency.