TEHRAN - Millions of Iranians voted in high-stake elections on Friday that could shift the balance of power within the hardline-controlled Islamic elite by ushering in a reformist comeback or help conservatives tighten their grip on power.

The contest is seen by some analysts as a make-or-break moment that could shape the future for the next generation, in a country where nearly 60 per cent of the 80 million population is under 30.

There were early signs of enthusiastic participation in the first polls since a nuclear deal last year led to a lifting of sanctions and deeper diplomatic engagement abroad.

Long queues formed at polling stations in the capital and state television showed throngs of voters in Ahvaz and Shiraz. It was unclear how the turnout might shape the outcome. "Whoever likes Iran and its dignity, greatness and glory should vote. Iran has enemies. They are eyeing us greedily," Supreme Leader Ayatollah Ali Khamenei said after casting his ballot, in a reference to Western powers.

"Turnout in the elections should be so high to disappoint our enemies ... People should be observant and vote with open eyes and should vote wisely."

At stake is control of the 290-seat parliament and the 88-member Assembly of Experts, the body that has the power to appoint and dismiss the supreme leader, Iran's most powerful figure. Both are currently in the hands of hardliners.

During its next eight-year term it could name the successor to Khamenei, who is 76 and has been in power since 1989.

Control of parliament will influence the ability of moderate President Hassan Rouhani, constrained so far, to deliver on his promises of greater freedoms and economic reforms - as well as his own chances of re-election next year.

The Guardian Council, appointed half by Khamenei and half by the ultra-conservative judiciary, disqualified thousands of candidates for the legislature and vetoed 80 per cent of those seeking election to the Assembly of Experts. That included Hassan Khomeini, the moderate grandson of Ayatollah Ruhollah Khomeini, the leader of Iran's 1979 Islamic revolution and Khamenei's predecessor.

As the day went on, Iranians waited patiently in long lines outside polling stations to cast ballots, with whole families coming together with their young children.

In Tehran, Mahshad Amiri, 33, an architect waiting to vote, said reformists allied to President Hassan Rouhani had a clear strategy of economic development and openness to the world. "We are engaged with the reformist movement not only for its political orientation but also because of its religious revival and renaissance ... We're looking for more freedom, culture, art, human rights and for better rights for our women," he said.

Marjohan Ranjbag, 36, a mother of two, said she preferred the conservative camp. "I have done my research and decided to vote for the principlists (hardliners), they are the best and care for the wellbeing of the people," she said.Supporters of Rouhani, who championed the nuclear deal and is likely to seek a second presidential term, are pitted against hardlines deeply opposed to detente with the West.

Rouhani said the government would spare no effort to protect people's votes and ensure healthy and legitimate elections, the official IRNA news agency reported.

The opposition website Kaleme said without elaborating that turnout was higher than in previous elections.

While reformists saw a high turnout as an opportunity for change, conservatives said it showed widespread popular support for the Islamic Republic's political system - and perhaps by extension the status quo. "To participate in the elections is to sign up to the country's ruling system," said Mohammad Yazdi, a conservative cleric who chairs the Assembly of Experts.

"When the Westerners see millions turn out, it's obvious their calculations will fall apart," said judicary spokesman and prominent hardline cleric Gholam Hussein Mohseni Ejei, according to Fars News. "They will discover that this population will no longer be dominated, influenced or oppressed by the enemy."

The Kaleme website reported that opposition cleric Mehdi Karoubi cast a ballot for the first time since being put under house arrest in 2011, in a gesture that may boost reformist candidates close to Rouhani.

A mobile ballot box was taken to his home, where he has been confined for five years. Karoubi and fellow reformist Mirhossein Mousavi, both in their 70s, ran for election in June 2009. They became figureheads for many Iranians, who protested against a contest they believed was rigged to bring back President Mahmoud Ahmadinejad, the official winner. The Interior Ministry said on Wednesday that all Iranians would be able to vote in the elections.

Asked what would happen if reformists did not win, he told Reuters: "It will be a major loss for the Iranian nation."

Rafsanjani called on election authorities to protect people's votes, saying "you should show our people that their votes will be preserved and are in safe hands."

Foreign Minister Mohammad Javad Zarif, who led nuclear talks with world powers, told Reuters while voting at the Jamaran mosque in northern Tehran that Iranians would continue to support policies that brought about the nuclear deal.

"The message to the international community from this election is the Iranians are solidly behind their government," he said. "They will continue to support the policies that have been adopted leading to the conclusion and successful implementation of the nuclear deal and this will continue."

Hundreds of onlookers cheered Hassan Khomeini, a politically moderate cleric, when he arrived to vote at Jamaran, witnesses said. A similar reception greeted reformist former president Mohammad Khatami.

Supporters of the reformist and moderate candidates barred by the Guardian Council, including Khomeini, have called on voters to back Rouhani's allies and keep the conservatives out.

If the experts' assembly is called on to choose a successor to Khamenei, its decision could set the Islamic Republic's course for years or even decades to come.

Mistrust of the West runs deep, and hardliners have sought to weaken Rouhani's allies by accusing them of ties to Western powers.

Whatever the outcome, though, Iran's political system places significant power in the hands of the Supreme Leader, who heads a conservative establishment including the Guardian Council, the judiciary, the Revolutionary Guards and state media.

Vote counting will start on Friday evening and some small constituencies could declare on Saturday morning, an electoral official said. Full results are expected early next week.

But it could take longer to get a clear picture of who has come out on top, as the numerous small parties and independent candidates form alliances and declare their allegiance.