By Parisa Hafezi
ANKARA (Reuters) - Iran's success in winning an end to international sanctions will only intensify a power struggle among the faction-ridden elite, and President Hassan Rouhani cannot count on domestic political support from the supreme leader before two critical elections.
However, Tehran's leadership has now decided on a less confrontational foreign policy than in the past, although a restoration of full ties with the "Great Satan" - the United States - remains out of the question, officials say.
The scrapping of most U.S., European Union and United Nations sanctions on Saturday under a nuclear deal with six major powers should strengthen both the economy and Shi'ite Iran's hand in a Mideast region torn by sectarian strife.
Rouhani, a pragmatist whose 2013 election cleared the way for the thaw in relations with the outside world, owes his success to Iran's top authority: Supreme Leader Ayatollah Ali Khamenei endorsed the nuclear agreement, overriding hardliners who oppose dealing with Washington.
"Every move by the government was approved by the leader. The leader protected us against hardliners' pressure," said a senior Iranian official, involved in the talks with the six powers which led to Tehran curbing its nuclear program in return for an end to the sanctions crippling its economy.
But hardliners, wary of Rouhani's growing influence and popularity, have already taken off the gloves to display the limits of the president's power at home where they oppose any political liberalization.
They fear that voters, hopeful living standards can rise with the end of sanctions, will reward pro-Rouhani candidates in elections next month to parliament and the Assembly of Experts, a clerical body with nominal power over the supreme leader.
"Rouhani has gained even more popularity compared to 2013 because of his nuclear success. This will help his allies greatly to win a majority in the elections," said another senior official. "People know that Rouhani's policy ended Iran's isolation and their economic hardship. He is their hero."
The elections to the Assembly of Experts are likely to be crucial in determining the future path of Iran, the top Shi'ite Muslim power which plans to pour large amounts of crude oil on to the global market now that the sanctions are gone.
Khamenei underwent prostate surgery in 2014 and should the 76-year-old supreme leader be unable to continue through illness, the Assembly would have to select his successor.
LEADERS AT LOGGERHEADS?
Rouhani's growing clout could put him at loggerheads with Khamenei, and any change in the balance of Iran's complex power structure might force the supreme leader to cut the president's domestic claws.
"Rouhani's political power will increase because of economic advances and this balance will be restored by more domestic pressure," said political analyst Hamid Farahvashian. "Without Khamenei's blessing, Rouhani cannot confront his rivals."
Khamenei - who took over in 1989 from Ayatollah Ruhollah Khomeini, the founder of the Islamic Republic - has always made sure that no group, including among his own hardline allies, gains enough power to challenge his authority.
"On the nuclear issue, Rouhani and Khamenei are in the same boat. But Khamenei will back hardliners in their political disputes against moderates," said a former official.
As well as the Guardian Council, which vets laws and election candidates, Khamenei controls the judiciary, the security forces, public broadcasters and foundations that control much of the economy.
The hardliners are likely to resort to a tactic they have successfully adopted in the past: finding grounds to disqualify pro-Rouhani candidates.
"I expect stormy days before the elections. Pressure will mount on Rouhani and his allies, including moderates' mass disqualifications," said political analyst Saeed Leylaz.
Hardliners have stepped up their calls to suppress dissenting voices since September, when Khamenei warned of "infiltration" by Iran's enemies.
They may also target political campaigners and reporters sympathetic to the president. "They will compensate for Rouhani's victory by more arrests of activists and more journalists will be summoned by the courts," said a pro-reform journalist, who asked not to be named for security reasons.
Opposition leaders Mirhossein Moussavi and Mehdi Karoubi remain under house arrest following street protests against what activists say was a rigged presidential election in 2009.
Rights groups and the United Nations have accused Iran of severely restricting freedom of expression, religion and the media as well criticizing its high number of executions.
Some analysts say Rouhani, who represented Khamenei at the Supreme National Security Council for over two decades, lacks the will to resist hardliners' pressure preventing the kind of social reforms that many young Iranians demand.
Rouhani has occasionally criticized the crackdown but has done little to stop it.
FOREIGN POLICY MODERATION
Iran's internal struggle is unlikely to be fought out over foreign policy, where the leadership appears to have agreed on a less confrontational line.
Its decision to release five Americans, including a Washington Post reporter, a few hours before the lifting of sanctions displayed this change of approach.
Tehran also swiftly ended an incident on Wednesday when it freed 10 U.S. Navy sailors a day after detaining them aboard their two patrol boats in the Gulf.
"It was a decision made by Iran's top authorities. It shows that there is a consensus over foreign policy among our decision-makers," said a senior security official.
Similarly hardline and pro-Rouhani authorities alike have condemned the storming of Riyadh's embassy in Tehran early this month by protesters reacting to the execution of Shi'ite Sheikh Nimr al-Nimr, an outspoken opponent of the ruling Al Saudi family. Dozens were arrested, according to state media.
"Iran has already adopted a moderate foreign policy. Even the hostility with the U.S. has transformed to a controlled one," said Leylaz. "We witnessed it during the sailors' capture and the Saudi embassy storming."
With Rouhani willing to improve ties with the United States, Tehran and Washington will continue to cooperate on the regional crisis including the rise of Islamic State, often known to its enemies by the Arabic name of Daesh.
"Iran and America need to work together in the region ... the taboo is broken and this channel of communication will remain open between the two countries," said the second senior official.
Tehran and Washington cut ties shortly after Iran's 1979 Islamic revolution and radical students stormed the U.S. embassy in Tehran, taking 52 Americans hostage for 444 days.
The official made clear there were limits to the rapprochement between Iran and the United States. "They have common interests and enemies ... Iran's fight against Daesh in Iraq and Syria is a clear example of it." However, the official added: "Full restoration of ties will not happen."
The elite Revolutionary Guards and its affiliated Basij militia forces have been leading Iran's effort against Islamic State in Iraq and Syria.
"In his public speeches and in private meetings with the government officials, Khamenei has made it very clear that the U.S. was and will remain Iran's foe," said Farahvashian. Under Iran's constitution, Khamenei, and not Rouhani, has the last say on all state matters.
(editing by David Stamp)