TUNIS, Tunisia — Like many Tunisian young people, Safouan el-Euchi proudly joined the 2011 protests that toppled the country’s dictator and lit the fires of the Arab Spring uprisings that spread across the Middle East.
But life since has been hard. His engineering degree has failed to get him a job, and prices are soaring. And though he votes at each opportunity, he wonders when the benefits of democracy will reach people like him.
“Life has gotten worse — more debt, more crime,” Mr. el-Euchi said after voting in Tunisia’s presidential election on Sunday. “How does freedom help us if there are no jobs?”
Sunday’s vote was another milestone in Tunisia’s transition from 22 years of dictatorship into the Arab world’s purest democracy. Although economic troubles and jihadist attacks have marred its progress, Tunisia has worked to remain an island of political openness — and perhaps a model for others — in a region of wars, monarchs, strongmen and sectarian divides.
“In the Arab world, there is dictatorship, they don’t have elections, they don’t have the peaceful transfer of power,” said Adnan Brahmi, the son of a Parliament member who was gunned down outside his home in 2013. “Tunisia shows them that nothing is impossible.”
The election Sunday was the second free presidential vote in the country’s history, and a useful indicator of the state of its democratic transition.
Over 12 days, 26 candidates from a range of backgrounds wooed voters, held rallies and debated live on television. On Sunday, voters went to the polls, and official results are expected in the coming days.
Analysts expect no candidate to win an outright majority, and a runoff between the top two vote-getters is expected next month.
Tunisia’s place in the Arab world was seared into history when a fruit seller named Mohamed Bouazizi lit himself on fire after a confrontation with the police, setting off protests that toppled the country’s longtime strongman, Zine el-Abidine Ben Ali, in 2011.
That surprise success inspired others frustrated by oppression and poor governance, leading to a series of uprisings that toppled dictators and rattled governments across Arab world.
Over time, most of those uprisings collapsed into violence or brought about results far from their original goals.
Egypt pushed out its longtime dictator, only to end up with a new one. Protesters in Syria took up arms and the country spiraled into a devastating civil war. Bahrain’s Sunni monarchy crushed an uprising by its Shiite majority with help from Saudi Arabia. And both Libya and Yemen have been shattered by conflict since their strongmen leaders were removed from power and killed.
Since providing the spark that started it all, Tunisia has appeared to spend the intervening years in an alternate reality, where violence has never quite boiled over, Islamists and secularists have struck rare compromises, and efforts to build democratic institutions have progressed.
Tunisia’s uniqueness was clear as the electoral campaign concluded on Friday night with large, raucous rallies across the capital, Tunis. Music blared and lights flashed from three stages on Avenue Habib Bourguiba, a boulevard lined with trees and cafes downtown.
A musician sang and strummed an acoustic guitar for the mostly secular fans of a leftist candidate, while supporters of Ennahda, an Islamist party, marched by waving flags and chanting their own candidate’s name.
Across town, a Tunisian rapper flanked by dancers in red hoodies wowed an audience before the arrival of yet another candidate, the country’s defense minister. Everywhere were T-shirts bearing candidates’ faces and slogans: “Elect the most able for a better Tunis” and “We need national sovereignty.”
And in a region where governments have shut out journalists and watchdogs, international election monitors with badges and notepads mixed in the crowd and security guards allowed reporters to take shortcuts between the rallies.
“I am optimistic because we are at the start of the road,” said Mohamed Faouzi Souihi, a retired soldier attending one of the rallies. “We have taken the first step and in 50 years, God willing, we will be better.”
Sunday’s vote had been scheduled for next month, but the death of President Béji Caïd Essebsi on July 25 meant it had to happen earlier so that the new head of state could be sworn in within 90 days, as per the Constitution.
That left less time for preparation and flipped the planned order of the presidential vote and parliamentary elections scheduled for Oct. 6, but led to no major crisis.
Many of the 26 candidates were well known, but analysts said their number made it hard to predict who would make the second round.
The candidates included Prime Minister Youssef Chahed; Defense Minister Abdelkarim Zbidi; Kais Saied, a law professor; and Abir Moussi, a woman who campaigned on nostalgia for the era of Mr. Ben Ali, the ousted president.
It was the first time that Ennahda, the Islamist party, fielded a presidential candidate, Abdelfattah Mourou, a 71-year-old cleric.
The election’s most surprising twist was the detention on charges of tax evasion and money-laundering of one of the highest-polling candidates, a populist media mogul named Nabil Karoui.
Mr. Karoui has been compared to former Prime Minister Silvio Berlusconi of Italy and is known for using his television station to publicize his charitable activities in poor areas.
His detention, shortly before the campaign opened, was based on a three-year-old investigation, and led to accusations from his supporters that powerful forces in the country were conspiring to sabotage his candidacy.
“The minimum in human rights is that you are innocent until proven guilty, but in this case you are guilty until we prove you innocent,” Mr. Karoui’s wife, Salma Smaoui, said in an interview.
It remains unclear who would decide whether Mr. Karoui can take office if he wins because Tunisia has yet to establish a constitutional court that could rule on whether victory would grant him presidential immunity that would get him out of jail, analysts said.
Whoever wins will face an uphill battle in a country where many people have lost faith in the political system and most feel that life is harder than it was before.
Tunisia’s election commission reported voter turnout on Sunday at 45 percent, down from 64 percent in the 2014 presidential vote. Inflation is high and unemployment stands at 15 percent, up three points from when Mr. Ben Ali ruled.
Across a trash-strewn lot from one polling station, five men in their 20s and 30s sat on plastic chairs under eucalyptus trees near a coffee shop. All had participated in the 2011 protests, but they said the revolution had failed to address the issues they cared about: unemployment, the cost of living and poor infrastructure.
None of them planned to vote.
“Eight years after the revolution and nothing has improved,” said Tarek Layouni, 35, who had been unemployed for three years after stints working in a car dealership and a fast-food restaurant.
Of Tunisia’s politicians, he said, “None of them have done anything.”
Others took a longer view, arguing that Tunisia’s democracy was still young and would bring benefits in the future.
“The new president needs to be the president for all, to bring Tunisians together and strengthen the economy,” said Dhaker Akremi, 50, who came to vote with his wife and their two young boys. “It is important that Tunisia continue on its democratic path.”