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 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 UPNow 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.