(Reuters) - Impressive gains by Iranian President Hassan Rouhani in heavily handicapped elections to parliament and a clerical body are evidence of an isolated nation eager to move from theocracy to a more open democracy, but few expect a sudden shift in power.

Iran's former president Ali Akbar Hashemi Rafsanjani (C), Iranian former vice president Mohammad Reza Aref (centre, L) and a group of reformists pose for a photo in Tehran February 22, 2016. REUTERS/Mohammad Kazempour/TIMA

The Islamic Republic’s unique dual system of clerical and republican rule places decisive power in the hands of a conservative Islamic establishment, which has shown in the past its ability to reassert control when it feels threatened.

Rouhani may have a stronger hand to open up an economy ravaged by a decade of sanctions, but his scope to permit more social and political freedom is constrained by hardliners’ control of the judiciary, security forces and state media.

The scale of gains by Rouhani’s supporters was undoubtedly a setback for hawks opposed to any opening to the West. Prominent critics of Iran’s nuclear deal with world powers were defeated.

Centrists and reformers not only bounced back in a parliament under hardline control since 2004, but won a stunning 15 out of the 16 Tehran seats in the 88-member Assembly of Experts, which selects Iran’s supreme leader. Two key hardliners including the speaker of the powerful clerical body were ousted.

Rouhani’s allies took all 30 parliamentary seats in Tehran, though their gains outside the capital were more limited, with conservatives keeping many seats in both bodies.

An unofficial tally by Reuters of first round results for the 290-member Majlis (parliament) show conservatives won about 112 seats, reformers and centrists 90 and independents and religious minorities 29. There will be run-offs in April in 59 districts where no one won more than 25 percent of the vote.

The numbers are approximate because Iran does not have rigid party affiliations. Some candidates were backed by both camps.

The advances came despite the disqualification of thousands pro-reform candidates by an unelected clerical Guardian Council that reports directly to Supreme Leader Ayatollah Ali Khamenei.

“The results in Tehran reflect a reformist orientation and focus on improvements in the economy and foreign relations,” said one Tehran-based analyst who requested anonymity.

“Rouhani will bring more order to the economy and greater openness in foreign policy but the overall structure and approach will not be altered. The vocabulary will be different, but the balance of power will not shift,” he said.

These contests could shape the future of the next generation in Iran, where nearly 60 percent of the 80 million population is under 30 and anxious to reintegrate into the international community and return to world markets following last year’s nuclear deal and the lifting of most of the punitive sanctions.

WILL OF THE PEOPLE

Rouhani’s main ally, ex-president Akbar Hashemi Rafsanjani, a shrewd operator who has survived every twist and turn in Iranian politics since the 1979 revolution and came top in the Assembly poll, urged hardliners not to stand in the way.

“No one is able to resist against the will of the majority of the people and whoever the people don’t want has to step aside,” he said in a Twitter message.

Rouhani’s foes include supporters of populist ex-president Mahmoud Ahmadinejad, religious hawks such as Ayatollah Mohammad-Taghi Mesbah Yazdi, who lost his assembly seat, but perhaps most dangerously hardliners around Khamenei and in the powerful Revolutionary Guards.

Rafsanjani’s tweet implied that the electoral gains have already started to change Iran’s balance of power.

They almost certainly cement Rouhani’s prospects of re-election next year, since friend and foe alike credit him for the nuclear deal that offered Iran a new relationship with the world.

The results may well also sway the selection of a successor to Khamenei, who holds ultimate state power but is 76 and underwent prostate surgery in 2014.

Slideshow ( 4 images )

The new parliamentary line-up could hasten Rouhani’s drive to open Iran to foreign trade and investment and loosen some of the legal shackles on economic activity.

Signaling post-election intentions, the president called on Tuesday for the privatization of the 50 percent state-owned car industry - the second biggest sector after oil and gas.

How far the elections will enable him to tackle corruption and vested economic interests is less certain.

Hardline fundamentalists, still entrenched in institutions Khamenei controls such as the judiciary, are keen to prevent either the new opening to the world or domestic liberalization.

In his first comment since the vote, the Supreme Leader praised the high turnout but made no comment on the results. He set out guidelines he would like to see in the newly elected bodies, suggesting they should not be influenced by the West.

The nuclear deal went through because Khamenei wanted it to end crippling sanctions. But he regularly cautions Iranians that the West will try to exploit it to undermine the Islamic system.

“The Supreme Leader cannot be very happy to see those supporting his policies losing and those may oppose his policies winning,” says Foad Izadi, a pro-conservative Iranian analyst.

TOO EARLY TO CELEBRATE

Almost all analysts agree it is too early for the reformist camp, or a young Iranian population yearning for change, to celebrate any decisive step forward for human rights and social freedoms, judging by historical precedent.

The last time reformers won the upper hand in parliament under President Mohammad Khatami in 2000, the Guardian Council vetoed several laws it passed as contrary to Islamic principles.

Khatami was then at the height of his popularity and the hardliners seemed on the ropes, humiliated by his landslide 1997 victory. Many then saw Iran heading for detente with the West, economic reform, social liberalization and political pluralism.

It ended in tears as conservatives used the judiciary and the Guardian Council to shut down the free space Khatami had opened, closing newspapers, locking up reformists, vetoing reform bills and denying his supporters access to state media.

Though re-elected triumphantly in 2001, Khatami soon became a lame duck due to their crackdown and the revelation of Iran’s secret nuclear program, which the president did not control.

The lesson was clear. All elected politicians, even the president, are ultimately under the thumb of appointed clerics, Islamic jurists and their opaque but powerful institutions, with the supreme leader at their apex.

Now, as then, Khamenei holds ultimate authority. He and the Revolutionary Guards set the limits, and determine the overall direction of the country by controlling the media, the military, intelligence services, morality police, Friday prayer leaders and the bulk of financial resources.

They are powerful but alarmed.

VESTED INTERESTS

An opening to the world of this magnitude - and Rouhani’s popularity - have panicked hardline allies of Khamenei, who fear losing control of the pace of change, as well as inroads into the lucrative economic interests they built up under sanctions.

At stake are the vested interests of the Revolutionary Guard Corps, which is not just Iran’s praetorian guard but an economic empire, with vast holdings from banking to construction and manufacturing. The Guards are still under U.S. sanctions for alleged support for terrorism.

This has exacerbated political infighting in Iran’s complex power structures. One indicator is what a U.N. envoy calls “an exponential increase” in executions ordered by the judiciary - more than 1,000 last year, according to human rights groups.

One big difference from 2000 is that Rafsanjani, who has wide patronage, is now backing Rouhani. Khatami’s reformists made the error of sidelining and humiliating the veteran dubbed “the shark” in the 2000 parliamentary election.

Some analysts predict that reformists may gradually gain a bigger say in power if they can consolidate their majority and establish a voice in picking the next supreme leader. This is not just wishful thinking; their opponents feel the same.

“In the Assembly of Experts the principalists (hardliners) lost seats. That part is more complicated because the people sitting there are theologians, jurists not necessarily politicians, but they do have a lot of power,” said Izadi, an assistant professor at Tehran University.

“In the Shi’ite theology the leader is not infallible.”

Unlike the Roman Catholic college of cardinals, which only convenes to elect a new pope, the Assembly of Experts can influence Khamenei during his lifetime, Izadi said.

“You don’t have to wait for the Pope to die. If they don’t like what the leader is doing and a significant minority is allied with Rouhani and Rafsanjani, they can put pressure on the leader” – especially if Rafsanjani becomes the next head of the assembly, which he was once before.

UNRESOLVED POWER STRUGGLE

Such pressure could also influence who Khamenei appoints as head of the judiciary, one of the main bulwarks of conservative power. “What we have is a shift,” Izadi said, leaving Khamenei “walking a tightrope trying to balance the whole thing”.

Part of that balancing act will be visible in the selection of the next speaker of the Majlis, a role held until now by Ali Larijani, a Khamenei ally who has shifted towards Rouhani.

Larijani, a former nuclear negotiator who engineered parliament’s support for the deal, won re-election in second place in the Shi’ite holy city of Qom. He could retain the influential chair in return for backing Rouhani’s economic reforms. His main rival, Mohammad Reza Aref, a former vice-president under Khatami and the reformists’ leading candidate for the Majlis, came first in Tehran.

Saeed Leylaz, a pro-reformist analyst and economist, is encouraged enough by the election results to believe Rouhani and parliament can now start working to liberalize the economy, curb corruption, entice investment and boost productivity.

“We have to go ahead with the liberalization of the economy, we have no other choice (if we are to) reduce poverty,” he said.

“The main powers in Iran are under the control of the supreme leader. Nothing will change dramatically or suddenly. Only in economic affairs we will have a much better position in parliament,” Leylaz said.

With its giant gas reserves, diversified industrial base and educated workforce, Iran is seen by global investors as a huge emerging market opportunity, in everything from cars to airplanes and railways to retail.

For ordinary Iranians, the prospect of foreign investment holds out the promise of a return to economic growth, better living standards and more jobs in the long run.

With so much in play after Iran’s international breakthrough on the nuclear deal, the simmering power struggle is likely to continue long after last Friday’s twin elections.