TEHRAN, Iran -- Millions of Iranians voted late into the night Friday to decide whether incumbent President Hassan Rouhani deserves another four years in office after securing a landmark nuclear deal, or if the sluggish economy demands a new hard-line leader who could return the country to a more confrontational path with the West.
The Islamic Republic's first presidential election since the 2015 nuclear accord drew surprisingly large numbers of voters to polling stations, with some reporting waiting in line for hours to cast their votes. Election officials extended voting hours at least three times at the more than 63,000 polling places to accommodate the crowds.
Four candidates remain in the race. But for most voters only two mattered, both of them clerics with very different views for the country's future: Rouhani and hard-line law professor and former prosecutor Ebrahim Raisi.
Rouhani is a political moderate by Iranian standards, but the 68-year-old has come to embody more liberal and reform-minded Iranians' hopes for greater political freedom at home and better relations with the outside world.
His supporters are also hoping he can make better progress on improving the economy, a key issue on the minds of the country's 56 million eligible voters. Many say they are yet to see the benefits of the nuclear deal, which saw Iran limit its contested nuclear program over the objection of hard-liners in exchange for the lifting of some sanctions.
Supreme Leader Ayatollah Ali Khamenei, the most powerful man in Iran, symbolically cast the election's first vote. He called for a large turnout, saying "the country is in the hands of all people."
In Tehran, whose liberal and affluent voters form the bedrock of support for Rouhani, lines at some precincts were much longer than those in his 2013 win. Analysts have suggested a high turnout will aid Rouhani in securing a second four-year term.
"I am happy I could vote for Rouhani," said Zohreh Amini, a 21-year-old woman studying painting at Tehran Azad University. "He kept the shadow of war far from our country."
Voters who spoke to The Associated Press from the cities of Bandar Abbas, Hamadan, Isfahan, Rashat, Shiraz and Tabriz also described crowded polling places.
The turnout may have spooked Raisi's camp, who filed a complaint to authorities over what they called "election violations" even before the polls closed, according to a report by the semi-official Tasnim news agency.
Tehran Friday prayer leader Ayatollah Mohammad Ali Movahedi Kermani urged voters to elect someone who won't be a "hostage" to Western governments and their culture.
"The next president should not be someone who makes the enemies happy when he is elected," said Kermani, who is an adviser to Khamenei.
Rouhani has history on his side in the election. No incumbent president has failed to win re-election since 1981, when Khamenei himself became president.
The 56-year-old Raisi, who heads an influential religious charitable foundation with vast business holdings, is seen by many as close to Khamenei. Raisi has even been discussed as a possible successor, though Khamenei has stopped short of endorsing anyone.
Raisi won the support of two major clerical bodies and promised to boost welfare payments to the poor. His populist posture, anti-corruption rhetoric and get-tough reputation -- bolstered by his alleged role condemning inmates to death during Iran's 1988 mass execution of thousands of political prisoners -- hold appeal for conservative rural and working-class voters.
"Rouhani has turned our foreign policies into a mess and damaged our religion," said Sedigheh Davoodabadi, a 59-year-old housewife in Iran's holy city of Qom who voted for Raisi. "Rouhani gave everything to the U.S. outright" in the nuclear deal.
Both candidates urged voters to respect the outcome of the vote.
Mostafa Hashemitaba, a pro-reform figure who previously ran for president in 2001, and Mostafa Mirsalim, a former culture minister, also remain in the race.
Iranians overseas were also voting in over 300 locations, including 55 in the U.S., where more than 1 million Iranians live.
Hard-liners remain suspicious of America, decades after the 1953 U.S.-engineered coup that toppled Iran's prime minister and the 1979 U.S. Embassy takeover and hostage crisis in Tehran. President Donald Trump's tougher stance on Iran has stoked concern as well, though his administration this week took a key step toward preserving the Obama-era nuclear deal.
Iran's political system combines conservative clerical oversight and state control over large parts of the economy with tightly regulated but still hotly contested elections for key government posts.
All candidates for elected office must be vetted, a process that excludes anyone calling for radical change, along with most reformists. No woman has ever been approved to run for president.
The president of the Islamic Republic oversees a vast state bureaucracy employing more than 2 million people, is charged with naming Cabinet members and other officials to key posts, and plays a significant role in shaping both domestic and foreign policy. But he remains subordinate to the supreme leader, who is chosen by a clerical panel and has the ultimate say over all matters of state.
The race has heated emotions and pushed public discourse in Iran into areas typically untouched in the tightly controlled state media.
That includes Rouhani openly criticizing hard-liners and Iran's powerful Revolutionary Guard, a paramilitary force now involved in the war in Syria and the fight against Islamic State militants in neighbouring Iraq. Rouhani also found his vehicle besieged by angry coal miners during a visit to a northern mine struck by a deadly explosion earlier this month.
But authorities worry about tempers rising too high, especially after the 2009 disputed re-election of former hard-line President Mahmoud Ahmadinejad that saw unrest, mass arrests and killings. Authorities barred Ahmadinejad from running in Friday's election, and Khamenei warned this week that anyone fomenting unrest "will definitely be slapped in the face."
That hasn't stopped those at Rouhani rallies from shouting for the release of the house-arrested leaders of the 2009 Green Movement. Opposition websites have said Green Movement leaders Mir Hossein Mousavi and Mahdi Karroubi both have endorsed Rouhani against Raisi. Rouhani promised in his 2013 campaign to free the men, but that pledge so far remains unfulfilled.
Mohammad Khatami, another reformist who served as Iran's president from 1997 to 2005, also has endorsed Rouhani and received a raucous welcome when he voted, according to a clip shared on social media.
Iranian authorities say they believe the vote will exceed a 70 per cent turnout.
Associated Press writers Nasser Karimi in Tehran and Jon Gambrell in Dubai, United Arab Emirates, contributed to this report