By Parisa Hafezi and Babak Dehghanpisheh
Iranians yearning for more freedom at home and less isolation abroad have emphatically re-elected President Hassan Rouhani, throwing down a challenge to the conservative clergy that still holds ultimate sway.
Interior Minister Abdolreza Rahmani-Fazli declared Rouhani's victory on Saturday on state TV, citing figures giving Rouhani about 57 percent of the vote in Friday's election, compared to 38 percent for his main rival, hardline judge Ebrahim Raisi.
Although the powers of the elected president are limited by those of unelected Supreme Leader Ayatollah Ali Khamenei who outranks him, the scale of Rouhani's victory gives the pro-reform camp a strong mandate to seek the sort of change that hardliners have thwarted for decades.
Rouhani's opponent Raisi, a protege of Khamenei, had united the conservative faction and had been tipped as a potential successor to the 77-year-old supreme leader. His defeat leaves the conservatives without an obvious flag bearer.
The re-election is likely to safeguard the nuclear agreement Rouhani's government reached with global powers in 2015, under which most international sanctions have been lifted in return for Iran curbing its nuclear program.
And it delivers a setback to the Revolutionary Guards (IRGC), the powerful security force which controls a vast industrial empire in Iran. They had thrown their support behind Raisi to safeguard their interests.
"We won. We did what we should do for our country. Now it is Rouhani's turn to keep his promises," said coffee shop owner Arash Geranmayeh, 29, reached by telephone in Tehran.
But Rouhani, 68, faces the same restrictions on his ability to transform Iran that prevented him from delivering substantial social change in his first term, and that thwarted reform efforts by one of his two-term predecessors, Mohammad Khatami.
The supreme leader has veto power over all policies and ultimate control of the security forces. Rouhani has been unable to secure the release of reformist leaders from house arrest. Courts have imposed a ban on the publication of the words -- or even images -- of the earlier reformist president, Khatami.
"The last two decades of presidential elections have been short days of euphoria followed by long years of disillusionment," said Karim Sadjadpour, senior fellow at the Carnegie Endowment who focuses on Iran.
"Democracy in Iran is allowed to bloom only a few days every four years, while autocracy is evergreen."
The re-elected president will also have to navigate a tricky relationship with Washington, which appears at best ambivalent about the nuclear accord agreed by former U.S. president Barack Obama. President Donald Trump has repeatedly described it as "one of the worst deals ever signed", although his administration re-authorized waivers from sanctions this week.
Trump arrived on Saturday in Saudi Arabia, his first stop on the first trip abroad of his presidency. The Saudis are Iran's biggest enemies in the region and are expected to push hard for Trump to turn his back on the nuclear deal.
TURN-OUT
Rouhani, known for decades as a mild-mannered member of the establishment, reinvented himself for his re-election campaign as an ardent reformist, seeking to stir up the passions of young, urban voters yearning for change.
At times he broke rhetorical taboos, openly attacking the human rights record of the security forces and the judiciary.
During one rally he referred to hardliners as "those who cut out tongues and sewed mouths shut". In a debate last week he accused Raisi of seeking to "abuse religion for power". The language at the debate earned a rare public rebuke from Khamenei, who called it "unworthy".
The contentiousness of the campaign could make it more difficult for Rouhani to secure the consent of hardliners to carry out his agenda, said Abbas Milani, director of the Iranian Studies program at Stanford University.
"Rouhani upped the ante in the past ten days in the rhetoric that he used. Clearly it's going to be difficult to back down on some of this stuff."
The Guards could also use their role as shock troops of Iran's interventions across the Middle East try to derail future rapprochement with the West, said Meir Javedanfar, an Iranian-born lecturer at Israel's Interdisciplinary Centre Herzliya.
"Since the 1979 revolution, whenever hardliners have lost a political battle, they have tried to settle scores," he said.
"I would worry about the more confrontational policy of the IRGC in the Persian Gulf ... and more confrontational policy with the U.S. and Saudi Arabia."
Among the congratulatory messages sent to Rouhani by world leaders, Iran's battlefield ally Syrian President Bashar al-Assad looked forward to cooperating "to strengthen the security and stability of both countries, the region and the world".
The biggest prize for Rouhani's supporters is the potential to set Iran's course for decades by influencing the choice of a successor to Khamenei, who has been in power since 1989.
A Raisi victory would have probably ensured that the next supreme leader was a hardliner. Rouhani's win gives reformists a chance to build more clout in the body that chooses the leader, the Assembly of Experts. Neither reformists nor conservatives dominate in the Assembly, and Rouhani's allies gained seats in an election last year for an eight-year term.
Khamenei praised Iranians for their big turnout after voters queued up for hours to cast their ballots. The strong turnout of around 73 percent of eligible voters appeared to have favored Rouhani, whose backers' main concern had been apathy among reformists disappointed with the slow pace of change.
Many voters said they came out to block the rise of Raisi, one of four judges who sentenced thousands of political prisoners to death in the 1980s, regarded by reformers as a symbol of the security state at its most fearsome.
"The wide mobilization of the hardline groups and the real prospect of Raisi winning scared many people into coming out to vote," said Nasser, a 52-year-old journalist.
"We had a bet among friends, and I said Raisi would win and I think that encouraged a few of my friends who might not have voted to come out and vote."
(Additional reporting by Bozorgmehr Sharafedin; Writing by William Maclean and Peter Graff)