For all the drama and the sometimes violent protests in the run-up to Senegal's presidential election, the former French colony looked set for a peaceful transition of power on Monday - a welcome boost for democracy in coup-prone West Africa.
Sunday's vote, which was delayed from its original date of Feb. 25, went off smoothly with supporters of opposition candidate Bassirou Diomaye Faye celebrating in the streets overnight as preliminary results put him firmly ahead.
On Monday, both Faye's rival in the ruling coalition, Amadou Ba, and outgoing President Macky Sall congratulated Faye for winning the election, before any official results from the electoral commission had come out.
"Organised in unusual conditions and having overcome a thousand difficulties, the March 24 presidential election will remain in our political history as one of ... the most transparent, peaceful and sincere," Sall said.
"The people of Senegal cemented the good health of our democracy."
Those words were pronounced by the same man who in February tried to postpone the election by 10 months a few hours ahead of the start of campaigning, rekindling fears over a democratic backslide in a region that has seen eight military coups in three years.
Senegal had been already rocked by deadly protests between 2021 and 2023, partly linked to fears that Sall would use changes to the constitution to extend his hold on power as other West African presidents had done before him.
The decision to postpone the vote prompted more demonstrations and risked plunging Senegal into chaos, Babacar Ndiaye, analyst and research director at West African Think Tank Wathi, said.
But after weeks of tension and another two attempts to postpone the vote and extend Sall's mandate - all rejected by Senegal's Constitutional Council and the Supreme Court - millions showed up calmly at the polls on Sunday. No major incidents were reported.
"Every time Senegal has been on the edge of the precipice, the country has managed to pull back, which is a testament of the strength of its democracy," Ndiaye told Reuters.
"What I saw yesterday, I had not seen before. People wanted to vote and make their voice heard. That issue of the attempted postponement left a bitter taste," he added.
NEXT TEST IN SOUTH AFRICA
While many observers will wait to see how Sall's supporters take the defeat of his candidate, events so far have once again set Senegal apart in a continent that has a history of contentious elections, often culminating in violent upheavals.
Recent votes in Nigeria, Kenya and the Democratic Republic of Congo saw losing candidates reject the results. The next major test for democracy on the continent will be the parliamentary vote in South Africa on May 29, where the ANC is expected to lose its majority for the first time since the end of apartheid in 1994.
Senegal also stands out in a region that has seen rapturous crowds take to the streets to celebrate their militaries seizing power in Niger, Burkina Faso, Mali and Guinea, where support for democracy has dropped steeply over the past decade, according to Afrobarometer data.
Those countries have seen Russia's influence grow at the expense of traditional allies such as France and the United States, and are also fighting Jihadist militants.
"The country's institutions, particularly the Constitutional Council, saved the electoral process, and some say they saved Senegal's democracy," Ndiaye said.
Sall was swept to power in 2012 on a wave of popular support which has since soured.
The jailing of opposition challengers, crackdowns on protests and moves to constrain Senegal's diverse media landscape had led Human Rights Watch to question the authorities' commitment to holding free and fair elections.
Political commentator Ibou Fall told Reuters that Senegal has a history of resisting attempts to tamper with its institutions, citing the public backlash in 2011 when former president Abdoulaye Wade tried to change the constitution.
"In reality, Senegal's reputation as a democracy has been regularly tested since independence (from France in 1960)," Fall said. "But it has resisted."