By Parisa Hafezi
(Reuters) - Iran's nuclear deal may be eroding its isolation overseas, but at home it is deepening political infighting within the country's complex power structure before two important elections, officials and analysts say.
The agreement - welcomed by Iranians eager for a lifting of sanctions and improved living standards - has increased the popularity of pragmatist President Hassan Rouhani, alarming hardline allies of Supreme Leader Ayatollah Ali Khamenei.
They fear Rouhani could challenge Khamenei's power if Iranians, grateful for a deal that may bring jobs and prosperity, reward the president in the votes early next year to parliament and the Assembly of Experts, a clerical body with nominal power over the supreme leader.
"The president's popularity has already increased since 2013 (when Rouhani won elections) because of the deal. People see him as a hero," said a senior Iranian official who asked not to be named. "Rouhani's allies have a very high chance to win a majority in the February elections."
That would upset a delicate political balance in the Islamic Republic's factionalized leadership.
The outcome of the votes will not affect Iran's foreign or nuclear policies, in which Khamenei has the final say, but a pro-reform parliament could help Rouhani to carry out a political agenda aimed at expanding social and economic liberties.
Parliament is dominated by conservatives and many analysts say Khamenei will not want Rouhani's allies to win a majority, as this would give the president too much power and influence. Instead, they expect Khamenei to use the elections to tighten his grip on power.
Rouhani enjoyed support from Khamenei, Iran's most powerful individual, over the 18 months of nuclear talks with the United States, Germany, France, Britain, China and Russia to settle a standoff that had lasted for more than a decade.
While Khamenei has yet to declare his support for the July 14 deal, in which Iran agreed to curb its nuclear program in exchange for an easing of sanctions crippling its oil-reliant economy, he gave Rouhani the political scope to pursue the negotiations. Iran says the program is peaceful while major powers suspected weapons development.
HARDLINERS STEP UP
Now Rouhani faces a challenge from hardline allies of Khamenei, who have taken off the gloves before the elections.
Khamenei has made sure that no group, including among his own allies, has ever gained enough power to challenge his status since 1989, when he took over from the founder of the Islamic Republic, the late Ayatollah Ruhollah Khomeini.
"If Rouhani and his camp win the majority in the elections, it will mean challenging Khamenei's utmost authority," said analyst Mansour Marvi.
Not everyone can run in Iranian elections. The hardline Guardian Council, made up of six clerics and six jurists seen as generally within Khamenei's orbit, has the authority to vet laws and candidates. Many expect the council to use its powers.
"Those who took over the first stronghold (2013 presidential vote) have plans to occupy the Assembly of Experts and the parliament ... to pursue their corrupt goals," the semi-official Fars news agency quoted hardline cleric Ahmad Janatti, chairman of the Guardian Council, as saying in May.
Jannati's remarks echoed statements made by other Khamenei allies, who warned of "the seditionists' agenda for the elections aimed at overthrowing the establishment".
Hardliners use the term "seditionists" to describe those who aligned with opposition forces after the disputed 2009 re-election of Mahmoud Ahmadinejad as president. His win over reformists triggered eight months of popular unrest that was eventually suppressed by force.
"Hardliners fear that if their rivals win, their position will be weakened," said political analyst Hamid Farahvashian.
"They have learned their lesson from the past when reformists were in power."
Some believe the Council may disqualify pro-reform candidates en masse to thwart any challenge to Khamenei. "Hardliners will use whatever political means they have to prevent their rivals from winning the elections," said a Rouhani ally, on condition of anonymity.
COUNCIL'S KEY ROLE
The Council also has the authority to determine whether parliamentary bills comply with Islamic rules and the constitution. In a possible harbinger of tough action, the Council rejected a bill in May that would automatically qualify current lawmakers to run in the next vote.
Hardliners have dominated parliament since 2004, when the Council disqualified about 4,000 pro-reform hopefuls, including 80 sitting members of the current parliament.
Hardline lawmakers have pressured Rouhani on various domestic issues and have threatened to reject the nuclear deal.
Rouhani, who represented Khamenei on the Supreme National Security Council for over two decades, appears in no mood to bow to the pressure, some analysts say.
"No political ... belief should be discounted ... Of course elections without competition are impossible," the official IRNA news agency quoted Rouhani as saying in May. "We have different ideas in our society, and all are free to express their ideas."
Apparent differences between Khamenei and Rouhani over the elections have sometimes broken into the open.
"The (Guardian) Council has a supervisory role and not an executive one. The government ... has necessary means to prevent election disorders and possible fraud," Rouhani said in August, challenging its authority to vet the candidates.
Khamenei shot back his disagreement, declaring: "The Guardian Council's oversight in the elections is approbatory and effective; this is their right, it is their legal right, it is their rational right."
A political analyst, who declined to be identified, said Rouhani could have Khamenei's backing as long as "his popularity and influence are not challenging the leader's authority. Otherwise, a power struggle between the two men is inevitable".
"But Rouhani is smarter than that. He will not challenge Khamenei's authority and at the end will tone down."
Any such challenge would probably fail to dent Khamenei's prestige, reducing Rouhani to a lame duck president in Iran’s multi-layered establishment, said a relative of Khamenei.
Khamenei, after all, controls the judiciary, the security forces, the Guardian Council, public broadcasters and foundations that own much of the economy.
"The leader is closely monitoring all the developments. The power balance should be preserved as well as his authority,” the relative said.
(Writing by Parisa Hafezi, Editing by William Maclean and Peter Millership)