She had badgered her friends and family to persuade them to vote for a major change of government. And on Friday, Aminata Faye, 22, stood at the front of a stadium in Senegal, in the city of Mbour, waiting to hear the opposition politician who had inspired her — and his presidential candidate — in the last stop in a breakneck campaign.

“They’re the only ones saying they’re going to change the system,” said Faye, a college student.

The West African nation of Senegal voted for a new president Sunday, in an election that many young people saw as a chance to overhaul the political and economic order. And it had been a nail-biting run-up.

Last month, the president, Macky Sall, had called off the election with only three weeks to go. Then he agreed to hold it after all. And suddenly, last week, he released from jail the pugnacious opposition figure many see as his nemesis — Ousmane Sonko — along with the man Sonko is backing for president, Bassirou Diomaye Faye.

The whiplash-inducing twists and turns have left many Senegalese relieved that the election was happening at all, and that so far their widely lauded democracy appeared to be intact.

People arrived early Sunday at polling stations, forming orderly queues and waiting their turns to cast ballots, the tranquil scenes in schoolyards and under trees standing in contrast to the drama of the previous month.

The initial turnout appeared to be high, with women, young people and older people represented. Many posted photos on social media of their fingers stained with pink ink, indicating that they had voted.

While there were 19 candidates, many experts think the election will go to a runoff between Faye and the governing party candidate, Prime Minister Amadou Ba. It is prohibited to publish opinion polls in Senegal during election season, so there is nothing concrete to indicate who was favored to win.

Thousands of young people flowed into the Mbour stadium to see Sonko Friday evening, the air filling with the honk of vuvuzelas. Binta Cissé, a 30-year-old cleaner, looked around at the sea of T-shirts bearing the faces of Sonko and his candidate, Faye, 43, a former tax inspector.

“We can see ourselves in them,” Cissé said.

The campaigning happened at a breakneck pace — and during Ramadan, when most people in the predominantly Muslim country fast during the day and celebrate at night, when campaigning happens.

Senegal, a country on the African continent’s westernmost tip, has watched as some of its neighbors — like Mali, to the east, and Guinea, to the south — have been overtaken by coups in recent years.

But Senegal, observers say, is different.

It has never had a coup d’état. The country’s powerful Sufi brotherhoods — Muslim communities guided by revered spiritual leaders — are seen as a stabilizing force. Its military prides itself on staying out of politics.