Ebrahim Raisi's main rival is the moderate former central bank governor Abdolnaser Hemmati, who says a win for any hardliner will mean more sanctions
Millions of Iranians voted on Friday in a contest set to hand the presidency to a hardline judge who is subject to US sanctions, though anger over economic hardship and curbs on freedoms mean many will heed calls for a boycott.
Senior officials appealed for a large turnout in an election widely seen as a referendum on their handling of the economy, including rising prices and unemployment and a collapse in the value of its currency.
"I urge everyone with any political view to vote," judiciary head Ebrahim Raisi, the front-runner in the contest, said after casting his ballot.
"Our people's grievances over shortcomings are real, but if it is the reason for not participating, then it is wrong."
While state television showed long queues at polling stations in several cities, the semi-official Fars news agency reported 22 million or 37% of voters had cast ballots by 7:30pm (1500 GMT), citing its own reporter. The interior ministry said it could not confirm turnout figures.
State television said voting officially ended at 1930 GMT. However, the interior ministry said voting had been extended for two hours in some polling stations across the country to allow latecomers to cast ballots.
The final results are expected to be announced by mid-day on Saturday.
After voting in the capital Tehran, Supreme Leader Ayatollah Ali Khamenei urged Iranians follow suit, saying "each vote counts ... come and vote and choose your president."
Raisi, 60, is backed by security hawks in his bid to succeed Hassan Rouhani, a pragmatist prevented under the constitution from serving a third four-year term in the post, which runs the government day-to-day and reports to Khamenei.
Supported by the powerful Revolutionary Guards Corps, Raisi, a close Khamenei ally who vows to fight corruption, is under US sanctions for alleged involvement in executions of political prisoners decades ago.
Voters reached by Reuters expressed mixed views.
Maryam, 52, a hairdresser in Karaj near Tehran, said she would not vote because "I have lost confidence in the system."
"Every time I voted in the past, I had hope that my living standard would improve. But I lost hope when I saw the highest official in the country wasn't brave enough to resign when he couldn't make things better," she said, referring to Rouhani.
Asked which candidate he preferred, Mohammad, 32, at a polling station in a hamlet in southern Iran, replied: "To be honest none of them, but our representative in parliament says we should vote for Raisi so that everything will improve."
"My vote is a big NO to the Islamic Republic," said Farzaneh, 58, from the central city of Yazd, referring to the country's system of clerical rule. She said contrary to what state TV reported, "the polling stations are almost empty here."
Mohammad, 40, an engineer, said he would not vote because "the results are known beforehand and more important, if Mr Raisi was serious about tackling corruption he should have done so by now."
More than 59 million Iranians can vote. While hundreds of Iranians, including relatives of dissidents killed since Iran's 1979 Islamic revolution and political prisoners, have called for an election boycott, the establishment's religiously devout core supporters are expected to vote for Raisi.
A win for Raisi would confirm the political demise of pragmatist politicians like Rouhani, weakened by the US decision to quit the nuclear deal and reimpose sanctions in a move that stifled rapprochement with the West.
The new sanctions slashed oil exports from 2.8 million barrels per day in 2018 to as low as an estimated 200,000 bpd in some months of 2020, although volumes have since crept up. Iran's currency, the rial, has lost 70% in value since 2018.
With inflation and joblessness at about 39% and 11% respectively, the clerical leadership needs a high vote count to boost its legitimacy, damaged after a series of protests against poverty and political curbs since 2017.
Official opinion polls suggest turnout could be as low as 44%, well below 73.3% in 2017.
Khamenei, not the president, has the final say on Iran's nuclear and foreign policies, so a Raisi win would not disrupt Iran's bid to revive the 2015 nuclear agreement and break free of US sanctions.
In Washington, a US State Department spokesperson said "Iranians were denied their right to choose their own leaders in a free and fair electoral process" - a likely reference to the hardline Guardian Council disqualifying several candidates.
"Our Iran policy is designed to advance US interests, regardless of who is in power," said the spokesperson on condition of anonymity. "Regardless of the outcome, we will continue discussions along with our allies and partners on a mutual return to compliance with the [nuclear deal]."
Raisi's record as a hardline judge accused of abuses could worry Washington and liberal Iranians, analysts said, especially given President Joe Biden's focus on human rights.
Khamenei appointed Raisi judiciary chief in 2019. A few months later, Washington sanctioned him for alleged abuses including what rights groups say was his role in the executions of political prisoners in 1980s and the suppression of unrest in 2009.
Iran has never acknowledged the mass executions, and Raisi has never publicly addressed allegations about his role.
Raisi's main rival is the moderate former central bank governor Abdolnaser Hemmati, who says a win for any hardliner will mean more sanctions.