Polling has ended in Iran’s presidential elections after being extended three times and by five hours.
Long queues had formed outside polling stations throughout the country after an unexpectedly high turnout.
Counting is under way, with more than 40 million votes cast.
Supporters of President Hassan Rouhani came out in big numbers after signs that the hard line backers of his main challenger, Ebrahim Raissi, had mobilised all their forces to vote.
Election officials said the extensions to voting hours were due to “requests” and the “enthusiastic participation of people”.
Ballot papers also ran out for Iranians voting in Istanbul in neighbouring Turkey, and attempts were made to fly in more from Tehran.
This election is seen as a key choice between the existing leadership and a hard line challenger.
President Hassan Rouhani is seeking a second term, standing against three other candidates.
Mr Rouhani is a moderate cleric who negotiated a landmark nuclear deal with world powers in 2015. His main rival is seen as Ebrahim Raisi, 56, a hard line cleric and former prosecutor who is close to Supreme Leader Ayatollah Ali Khamenei.
If no-one wins more than 50% of votes cast, a run-off will be held next week.
Every incumbent president has been re-elected in Iran since 1985, when Ayatollah Khamenei himself won a second term.
He cast his ballot just minutes after polls opened at 08:00 local time.
“Everyone should vote in this important election,” he said, urging citizens to get the polls early.
Mr Rouhani voted about an hour later.
More than 54 million people were eligible to vote in the presidential election.
Six candidates were approved by the Guardian Council, an influential clerical body controlled by conservatives, but two of them dropped out earlier this week.
The first was Tehran’s hard-line mayor, Mohammed Baqer Qalibaf, who pledged his support for Mr Raisi on Monday.
He was followed on Tuesday by Vice-President Eshaq Jahangiri, a reformist, who pulled out to smooth the path for Mr Rouhani.
The two other candidates still in the race are Mostafa Hashemitaba, a reformist, and Mostafa Mirsalim, an ultra-conservative figure.
On the final day of campaigning on Wednesday, Ayatollah Khamenei called for a massive turnout to demonstrate the popularity of the Islamic regime.
“American, European officials and those of the Zionist regime are watching our elections to see the level of participation,” he said.
“The Iranian nation has enemies. Faced with the enemy, the people should show its determination and calm,” he added.
The supreme leader also warned that “any attempt to undermine the security of the country will be met with immediate reaction”.
In 2009, the disputed re-election of Mahmoud Ahmadinejad triggered the biggest protests in Iran since the Islamic Revolution in 1979.
Millions of people claimed their votes had been stolen and demanded a re-run, but Ayatollah Khamenei insisted the result was valid and ordered a major crackdown on dissent that saw dozens of opposition supporters killed and thousands detained.
Source: world bbc