Soon after the peaceful transition of power from Barack Obama to Donald Trump in the US, Gambia's crisis was also resolved without a single gunshot. The embattled President Yahya Jammeh appeared on national TV announcing his decision "to relinquish the mantle of leadership".
Jammeh's decision to step down was not only important to his own people, as he effectively decided not to push the country into bloodshed to retain power, but it also set an important precedent in Africa for a peaceful transition of power after a decades-long dictatorship.
The descent into a preventable crisis
The political turmoil in Gambia, was the result of what I call "the curse of an authoritarian electoral defeat". It is a curse that plagues any country with long authoritarian rule where questions about the fate of the outgoing leader during and after the handover of power and about the transition from authoritarian to democratic politics remain unresolved.
Jammeh took power in Gambia in 1994 through a military coup and stayed in power for 22 years, getting regularly re-elected in, what were perceived as, unfair elections. On December 1, 2016 Jammeh's opponent, Adama Barrow, won the elections with a four percent lead, a defeat that the incumbent initially accepted.
The crisis started when, on December 9, Jammeh rescinded his earlier concession of defeat . Although Jammeh claimed that there were electoral irregularities, what really pushed him to change his mind was his fear of political reprisals against him by the opposition.
Instead of seizing Jammeh's concession of defeat as an opportunity to negotiate an exit strategy ensuring peaceful transfer of power, politics of vengeance, not uncommon in transitions from authoritarian rule, started to creep into the political discourse. Members of the opposition started talking about annulling Gambia's withdrawal from the International Criminal Court, refusing immunity to Jammeh, having him prosecuted, and seizing his assets.
Jammeh was cornered and went on the offensive, declaring a state of emergency and pressing the parliament to extend his rule by three months.
Central to the success of diplomatic efforts to resolve the crisis was regional leadership. The Economic Community of West African States (ECOWAS) took the lead both in setting the agenda and launching the diplomatic process which involved five rounds of presidential missions to Banjul mobilising a total number of six African presidents, including Nobel Peace Prize laurate, Ellen Johnson Sirleaf, president of Liberia.
Unlike in other African transfer of power crises, where power sharing was the focus of negotiations, ECOWAS decided not to compromise and pushed for enforcing the outcome of the December 1 elections.
Its diplomatic efforts also received firm support from international actors such as the African Union, which warned Jammeh of " serious consequences ", the United Nations, and the European Union.
An important factor in the successful resolution of the crisis was that ECOWAS did not limit its actions only to diplomacy, but also backed its efforts with a credible threat of military action. Apart from its 17 December summit decision to "undertake all necessary action" - a euphemism for use of force - ECOWAS member states mobilised their troops and prepared to enter Gambia's territory upon the expiry of the 19 January deadline they set for Jammeh to leave power.
The crumbling of Jammeh's regime from inside was major internal catalyst for the swift and peaceful end of the stalemate. The string of cabinet resignations followed by the departure of long-time vice president, Isatou Njie-Saidy, forced Jammeh to dissolve his cabinet entirely. Even Jammeh's military chief who stood by him throughout the crisis eventually announced that he had no plan to fight the ECOWAS troops marching into the Gambia.
Trying to avoid bloodshed, ECOWAS decided not to follow up on its initial threat of ensuring the inauguration of Mr Barrow in Banjul and instead opted for an extraordinary decision to swear Gambia's new president in the Gambian embassy in Senegal's capital, Dakar on January 19 .
This act sealed Jammeh's political defeat, paving the way for the AU and others to withdraw their recognition of Jammeh and welcome Mr Barrow as the legitimate president of Gambia.
A lesson for other African dictators
What ultimately guaranteed the peaceful end of the crisis was the eventual successful negotiation of the terms for Jammeh's exit. In exchange for peaceful transfer of power to the new president, he received guarantees of a secure retirement with full benefits of a citizen, a party leader and a former head of state.
In this way, Gambia set an important precedent for other authoritarian rulers, who continue to be in power long after losing popular support due to their uncertain future. Gambia's experience shows that they can get a dignified exit, if they allow free and fair election.
In so doing, not only would they spare their countries the agonies of a violent transition, but also avoid the fate of Ivory Coast's former president Laurent Gbagbo, who is on trial at the ICC after he was forced out of power by a French military intervention in 2011.
The clear lesson for opposition parties and the citizenry in countries with authoritarian leaders is that not only should they forge unity during elections, but also prepare to work with regional and international bodies for a negotiated exit guaranteeing peaceful transfer of power.
As Barrow's plan to convene a truth and reconciliation commission for dealing with past abuses shows, Jammeh's exit does not completely preclude the pursuit of measures of accountability as part of an inclusive transitional process.
Solomon Ayele Dersso is a senior legal scholar and an analyst on Africa and African Union affairs.
The views expressed in this article are the author's own and do not necessarily reflect Al Jazeera's editorial policy.