Iranians vote for president on Friday in a contest likely to determine whether Tehran's re-engagement with the world stalls or quickens, although whatever the outcome no change is expected to its revolutionary system of conservative clerical rule.
Seeking a second term, pragmatist President Hassan Rouhani, 68, remains the narrow favourite, but hardline rivals have hammered him over his failure to boost an economy weakened by decades of sanctions.
Many Iranians feel a 2015 agreement he championed with major powers to lift sanctions in return for curbing Iran's nuclear programme has failed to produce the jobs, growth and foreign investment he said would follow.
The normally mild-mannered cleric is trying to hold on to office by firing up reformist voters who want less confrontation abroad and more social and economic freedom at home.
In recent days he has adopted robust rhetoric, pushing at the boundaries of what is permitted in Iran. He has accused his conservative opponents of abusing human rights, misusing religious authority to gain power and representing the economic interests of the security forces.
Rouhani's strongest challenger is hardline cleric Ebrahim Raisi, 56, who says Iran does not need foreign help and promises a revival of the values of the 1979 Islamic Revolution.
He is backed by Iran's elite Revolutionary Guards, the country's top security force, their affiliated volunteer Basij militia, hardline clerics and two influential clerical groups.
Another prominent conservative, Tehran Mayor Mohammad Baqer Qalibaf, withdrew from the race on Monday and backed Raisi, uniting the hardline faction and giving Raisi's chances a boost.
Under Iran's system, the powers of the elected president are circumscribed by those of the conservative supreme leader, Ayatollah Ali Khamenei, who has been in power since 1989. All candidates must be vetted by a hardline body.
Nevertheless, elections are fiercely contested and can bring about change within the system of rule overseen by Shi'ite Muslim clerics.
The main challenger Raisi is a close ally and protege of Khamenei, and was one of four Islamic judges who ordered the execution of thousands of political prisoners in 1988. Iranian media have discussed him as a potential future successor to Khamenei, who turns 78 in July.
Raisi has appealed to poorer voters by pledging to create millions of jobs.
"Though unrealistic, such promises will surely attract millions of poor voters," said Saeed Leylaz, a prominent Iranian economist who was jailed for criticising the economic policies of Rouhani's hardline predecessor Mahmoud Ahmadinejad.
Although the supreme leader is officially above the fray of everyday politics, Khamenei can sway a presidential vote by giving a candidate his quiet endorsement, a move that could galvanise hardline efforts to get the conservative vote out.
"Raisi has a good chance to win. But still the result depends on the leader Khamenei's decision," said a former senior official, who declined to be identified.
So far in public Khamenei has called only for a high turnout, saying Iran's enemies have sought to use the elections to "infiltrate" its power structure, and a high turnout would prove the system's legitimacy.
A high turnout could also boost the chances of Rouhani, who was swept to power in 2013 on promises to reduce Iran's international isolation and grant more freedoms at home. The biggest threat to his re-election is apathy from disappointed voters who feel he did not deliver improvements they hoped for.
"The result depends on whether the economic problems will prevail over freedom issues," said an official close to Rouhani. "A low turnout can harm Rouhani."
Polls taken by International Perspectives for Public Opinion on May 10 show Rouhani still leads with about 55 percent of the votes, although such surveys do not have an established record of predicting election outcomes in Iran.
If no candidate wins more than 50 percent of votes cast, the top two candidates will compete in a runoff election on May 26.
Because the conservatives are now mostly united behind Raisi, the result is likely to be closer than four years ago, when Rouhani won more than three times as many votes as his closest challenger en route to a victory in a single round.
Slow pace of change
Opposition and reformist figures are backing Rouhani. The Kalameh website reported that opposition leader Mirhossein Mousavi, under house arrest since 2011, had requested a mobile ballot box be brought to his residence so that he could vote for Rouhani.
Rouhani's recent fiery campaign speeches have led to a surge of public interest. Yet many voters' expectations of radical change are low.
"I had decided not to vote … Rouhani failed to keep his promises. As long as Khamenei runs policy, nothing will change," said art student Raika Mostashari in Tehran.
But she eventually decided to vote for Rouhani, she said, because former president Mohammad Khatami, spiritual leader of the pro-reform movement, had publicly backed him.
Rouhani's signature accomplishment has been his nuclear deal, which could be in jeopardy if he loses power, even though it was officially endorsed by Khamenei and all candidates say they will abide by it.
US President Donald Trump has frequently called the agreement "one of the worst deals ever signed" and said Washington will review it.
Although the agreement lifted international sanctions, the United States continues to impose unilateral measures that have scared off investors. Washington cites Iran's missile programme, its human rights record and support for terrorism.
Some experts say Iranian establishment figures may want to keep Rouhani in power to avoid being cast back into isolation.
"With the deal in jeopardy, the system will be in vital need of Rouhani's team of smiling diplomats and economic technocrats to shift the blame to the US and keep Iran's economy afloat," said Iran analyst Ali Vaez of the International Crisis Group.
Polls expected to open at 03:30 GMT and close at 13:30 GMT, which can be extended. Final results are expected by Sunday.