By Parisa Hafezi
ANKARA (Reuters) - Iran's hardliners are preparing to bring President Hassan Rouhani to heel if U.S. President Donald Trump scraps Tehran's nuclear deal with major powers, officials and analysts believe.
Trump has threatened to abrogate the 2015 agreement by not extending sanctions waivers when they expire on May 12, if Britain, France and Germany do not "fix" its "terrible flaws".
This sets the stage for a resurgence of political infighting within Iran's complex power structure, Iranian officials said.
Annulment of the accord could tip the balance of power in favor of hardliners looking to constrain the relatively moderate Rouhani's ability to open up to the West.
While the spotlight is on Trump's eventual decision there will be a display of unity in Tehran, a senior Iranian official told Reuters, on condition of anonymity.
"But when the crisis is over, hardliners will try to weaken and sideline the president," the official said.
Nor can the president expect any weakening of Iran's system of clerical rule as a result of the uncertainty surrounding the nuclear deal, meaning "Rouhani will be in a no-win situation", said a relative of Khamenei.
For Rouhani the stakes are high. If the deal falls apart, he could become politically vulnerable for promoting the 2015 accord, under which non-nuclear sanctions were lifted in return for Tehran curbing its nuclear program.
"It will also lead to a backlash against the moderates and pro-reformers who backed Rouhani's detente policy with the West ... and any hope for moderation at home in the near future will fizzle out," said political analyst Hamid Farahvashian.
It is a delicate balance. Supreme leader Ayatollah Ali Khamenei knows that Iranians, many of whom took to the streets earlier this year to protest against high food prices, can only take so much economic pressure.
But the establishment does not want too much of an opening to the West, despite the likely economic benefits. A weakened Rouhani, unable to push such policies, is likely to serve out his term, which ends in 2021, another senior official said.
"His removal would be a sign of weakness for the system. It would harm its legitimacy abroad," the official said. "But he will be blamed and pressured for the economic malaise."
Khamenei gave guarded backing to Rouhani when he opened the door to nuclear diplomacy with world powers in order to end Iran's economic and political isolation.
But the Supreme Leader's aversion to the United States remains a formidable barrier to any diplomatic solution now, so a Trump withdrawal would make it hard for Rouhani to pursue better relations with the West.
"The internal politics will make it difficult, if not impossible, for Rouhani to pursue detente with the West and make concessions in return for economic gains," said another Iranian government official.
The European signatories of the deal have tried to persuade Trump not abandon it because they want to keep trading with Iran.
Despite threats to walk away if Trump buries the deal, several Iranian officials said that "as long as Tehran was not excluded from the global financial and trading system" it could consider respecting the accord.
But many foreign firms are hesitant to invest in Iran, worried by unilateral U.S. sanctions imposed over human rights violations, terrorism, and the dominant role of the Revolutionary Guard Corps (IRGC) in Iran's economy.
That is another area where Rouhani is exposed. He has sought without much success to curb the economic activities of the IRGC in order to attract foreign investment.
But under the command of Khamenei, the IRGC has ignored the government's attempts to limit its involvement in the economy.
If the nuclear deal collapses, what power Rouhani has to limit that involvement will decline further, boosting hardliners who want to see the president's powers reined in.
The IRGC has done well since the sanctions relating to the nuclear deal were lifted, using front companies with no obvious link to the Guard to serve as a conduit for investors returning to Iran.
If sanctions are reimposed as a result of the collapse of the nuclear deal, the Guard is well placed to evade them.
"Considering their vast business network and political and military influence, the IRGC will be back to the business of evading sanctions as they did for years in the past," said a western diplomat in Tehran.
The IRGC stepped in when European oil companies abandoned energy projects after the United States and the European Union imposed sanctions in 2012.
"Sepah (the IRGC) is an asset for Iran. They protect Iran whenever needed ... They rescued the economy when the enemies wanted to crush us with sanctions," said a hardline politician who declined to be identified.
"If European investors yield to America's pressure and leave Iran, then Sepah will take over," he said.
Concerns over possible Israeli military action against Iran's nuclear facilities have empowered the IRGC, which runs security at home and abroad.
But experts believe that even under the umbrella of an emboldened IRGC, hardliners might hesitate to apply harsh policies, fearing a revival of the anti-government protests in January that showed the establishment was vulnerable to popular anger fueled by economic hardship.
(Writing by Parisa Hafezi; Editing by Giles Elgood)