A final deal to resolve the Iran nuclear crisis could heighten domestic political tensions with two major elections looming in the Islamic Republic, analysts and officials said.
Easing economic sanctions will bolster President Hassan Rouhani's position within Iran's complex power structure bringing a political boost for liberal candidates in 2016 elections for parliament and for the Assembly of Experts, a clerical body with nominal power over the supreme leader.
Supreme leader Ayatollah Ali Khamenei, who has the final say on all matters of state, has backed Rouhani's efforts to pursue a nuclear settlement and his dealings with the United States so as to improve the parlous state of Iran's economy.
But Khamenei, who took over in 1989 from the founder of the Islamic Republic, the late Ayatollah Ruhollah Khomeini, has also worked to ensure that no group, including among his own hardline allies, gains enough power to challenge him.
Khamenei will not want pragmatist President Rouhani to gain too much power and influence ahead of the important elections, an Iranian official said.
"The leader has always made sure not to give too much authority to any official because it will damage the political establishment," said the official, who asked not to be named.
"He is above all political factions and only acts based on Iran's interests."
A nuclear deal was reached on Tuesday after nearly three weeks of round-the-clock negotiations among Iran, the United States, Russia, China, France, Britain and Germany aimed at agreeing a halt to Iranian nuclear work in return for sanctions relief. The West says Iran is seeking to build weapons but Iran says its nuclear programme is to produce power.
Rouhani, who represented Khamenei on the Supreme National Security Council for over two decades, will continue to enjoy Khamenei's blessing as long as his growing prestige at home and abroad does not threaten Khamenei's authority, analysts say.
An economic dividend could tip the balance of power in favour of Rouhani, whose allies could well be rewarded at the ballot box, to the detriment of other groups, including security hawks close to Khamenei.
"The deal will fuel domestic tension and pressure will increase inside the country," said Iran-based analyst Saeed Leylaz.
"There will be two powerful minorities in the next parliament, reformists and conservatives. And one weak minority of hardline conservatives," said Leylaz. "No group will have the final say."
Inflation, unemployment and other economic hardships persuaded Khamenei to support Rouhani on the nuclear question, but success in the early 2016 elections could be seen as a challenge to the leader's authority, said a former senior Iranian diplomat.
"In order to clip his wings, pressure will mount on Rouhani's government in other fields like human rights, disqualifying pro-reform election candidates and so on," said the former diplomat, who spoke on condition of anonymity.
Rouhani in jeopardy?
Iran's top post wields immense power, controlling the judiciary, the security forces, the Guardian Council which vets laws and election candidates, public broadcasters and foundations that own much of the economy.
If the pro-Rouhani camp wins the elections, it will be the first time in the history of the Islamic state that one faction controls all the key institutions. "It might even jeopardise Rouhani's position. It might be the end of Rouhani's honeymoon with Khamenei," said analyst Mansour Marvi.
Iran has suffered under economic sanctions for decades, and especially over the last three years, when much tighter US and European measures drastically cut the oil exports that are the engine of its economy.
While a deal may improve the economy, many Iranians who supported Rouhani's 2013 election remain frustrated, fearing that his diplomatic triumph is likely to put him on a shorter leash on internal reforms and improvements in human rights.
"Giving carte-blanche to Rouhani to carry out cultural and political reforms is not on the leader's agenda," said analyst Hamid Farahvashian.
Allies under pressure
There are already signs that the pendulum is swinging against Rouhani's allies.
Since February, Iran's judiciary has banned media from publishing the pictures of reformist former president Mohammad Khatami, whose support was crucial to Rouhani's election win.
Khatami ran foul of the establishment by supporting opposition leaders Mirhossein Moussavi and Mehdi Karoubi, key figures in anti-regime street protests after the disputed 2009 presidential election. The two men remain under house arrest.
The son of former president Ayatollah Akbar Hashemi Rafsanjani, another supporter of Rouhani, was given jail sentences in March on corruption and security charges.
A recent US government report harshly criticised Iran's human rights record, citing severe restrictions on freedom of expression, religion and the media as well as the country's having the second-highest number of executions.
Members of the Iranian opposition abroad are losing hope for change because Rouhani has not met his promises to create a freer society, including loosening Internet restrictions. Access to social media remains officially blocked, though Rouhani and Khamenei have their own Twitter accounts.
"More international recognition means more domestic pressure inside Iran," said Reza, who has been living in exile in Europe since 2010, when he was released from prison in Tehran for participating at 2009 demonstrations.
"I have no hope of returning," said Reza, who would not give his surname. "Rouhani will not or cannot change the situation."