DUBAI (Reuters) - Iranians yearning for detente abroad and greater freedoms at home have handed President Hassan Rouhani a second term, but the hardline forces he defeated in elections on Friday will remain defiantly opposed to his plans.

Iran's President Hassan Rouhani visits the election office in Tehran, Iran, May 19, 2017. Picture taken May 19, 2017. President.ir/Handout via REUTERS

Rouhani built his resounding win in Friday’s presidential election by promising more economic opportunities for Iran’s youth, as well as social justice, individual freedoms and political tolerance.

He also picked a rare public fight with hardliners close to Supreme Leader Ayatollah Ali Khamenei, angrily criticizing their favorite in the race, Ebrahim Raisi, a judge seen by reformists as representing the security state at its most fearsome.

The Revolutionary Guards (IRGC), the country’s most powerful security force, are unlikely to forget his attacks, which played to widespread frustration with a state that controls how Iranians speak, gather and dress.

During one rally Rouhani referred to hardliners as “those who cut out tongues and sewed mouths shut”.

“Rouhani will face more pressure in his second term. The Revolutionary Guards and other deep state organizations will create more problems for him,” said Meir Javedanfar, an Iranian-born Israeli lecturer on Iran at the Interdisciplinary Center Herzliya in Israel.

“Since the 1979 revolution, whenever hardliners have lost a political battle, they have tried to settle scores.”

One way the Guards could re-assert their dominance at home would be to stoke more confrontation abroad, where they provide the shock troops for Iran’s interventions in Iraq, Syria and elsewhere in the Middle East.

“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,” said Javedanfar.

COLLISION COURSE

Rouhani’s allies say he still has the wherewithal to deliver progress. An insider from within the upper echelons of power, he has worked with the supreme leader Khamenei for decades.

“As the economy is among Khamenei’s top priorities, Khamenei will be obliged to give limited backing to Rouhani’s liberal economic policy like the cautious support he gave to the nuclear deal,” said an official, close to Rouhani’s government.

Rouhani, first elected in a landslide in 2013 on a promise to reduce Iran’s diplomatic isolation, spent most of his political capital in his first term on a nuclear agreement with six powers that resulted in a lifting of most sanctions in return for curbs on Tehran’s nuclear program.

Domestic social reforms were largely ignored. But in his second term Rouhani will be under more pressure from his followers to deliver on changes at home. He has now contributed to that pressure himself by campaigning hard as a reformist, particularly in the final days.

“Clearly it’s going to be difficult to back down on some of this stuff,” said Abbas Milani, director of the Iranian Studies program at Stanford University.

Milani noted “the challenges he gave to the IRGC” as well as promises to release reformist leaders held under house arrest. “All of these are going to put him on a confrontation path if not a collision course with the conservatives,” he said.

The internal power struggle in the Islamic Republic is not just a philosophical argument between reformists and hardliners, but a battle to preserve the dominance of a theocratic establishment with vested interests and privileges.

The Revolutionary Guards have an extensive business empire to protect, and believe opening up to the West could lead to regime change. Given the importance of the Guards to the clerical leadership, few Iranians harbor high hopes that Rouhani will to fulfill all his promises.

“Rouhani will likely be unwilling or unable to push back against hardliners.... Those who want real change ... will once again -- and most unfortunately -- be stuck between a rock and a hard place,” said Behnam Ben Taleblu, a senior Iran analyst at Washington-based Foundation for Defense of Democracies.

Still, the prospect of victory by Raisi, who was one of four judges in the 1980s that approved the death sentences of thousands of political prisoners, was enough to drive even doubtful Iranians out to vote for Rouhani in force.

“Iranians are perhaps not overly optimistic that Rouhani can move the country forward, but at least he didn’t want to drive the country backward,” Karim Sadjadpour, senior fellow at the Carnegie Endowment who focuses on Iran, told Reuters.