BAGHDAD (Reuters) - Populist cleric Moqtada al-Sadr, a long-time adversary of the United States, has all but won Iraq’s parliamentary election, the electoral commission said, in a surprise turn of fortune for the Shi’ite leader.

In the first election since Islamic State was defeated in the country, Iran-backed Shi’ite militia chief Hadi al-Amiri’s bloc was in second place, while Prime Minister Haider al-Abadi, once seen as the front-runner, trailed in third.

The preliminary results were based on a count of more than 91 percent of the votes cast in 16 of Iraq’s 18 provinces.

Sadr’s bloc did not run in the remaining two provinces, Kurdish Dohuk and the ethnically-mixed oil province of Kirkuk. The results there, which may be delayed due to tensions between local parties, will not affect Sadr’s standing.

Unlike Abadi, a rare ally of both the United States and Iran, Sadr is an opponent of both countries, which have wielded influence in Iraq since a U.S.-led invasion toppled Sunni dictator Saddam Hussein in 2003 and thrust the Shi’ite majority into power.

Sadr has led two uprisings against U.S. forces in Iraq and is one of the few Shi’ite leaders to distance himself from Iran.

Despite the election setback, Abadi might still be granted a second term in office by parliament and on Monday he called on all political blocs to respect the results and suggested he was willing to work with Sadr to form a government.

“We are ready to work and cooperate in forming the strongest government for Iraq, free of corruption,” Abadi said in a live televised address. Corruption has been at the top of Sadr’s agenda for several years.

Projecting himself as an Iraqi nationalist, Sadr has a zealous following among the young, poor and dispossessed, but he had been sidelined by influential Iran-backed figures.

He cannot become prime minister as he did not run in the election, though his apparent victory puts him in a position to pick someone for the job.

But even then, his bloc might not necessarily form the next government. Whoever wins the most seats must negotiate a coalition government in order to have a majority in parliament. The government should be formed within 90 days of the official results.

Saturday’s election is the first since the defeat of Islamic State last year. The group overran a third of Iraq in 2014.

Turnout was 44.52 percent with 92 percent of votes counted, the Independent High Electoral Commission said, the lowest participation rate in Iraq’s post-Saddam history. Full results are due to be officially announced later on Monday.

ELECTION CALCULUS

Sadr and Amiri both came in first in four of the 10 provinces where votes were counted, but the cleric’s bloc won significantly more votes in the capital, Baghdad, which has the highest number of seats.

A document provided to Reuters by a candidate in Baghdad that was also circulating among journalists and analysts showed results from all 18 provinces.

Reuters could not independently verify the document’s authenticity but the results in it for the 16 announced provinces were in line with those announced by the commission.

Reuters calculations based on the document showed Sadr had won the nationwide popular vote with over 1.3 million votes and gained around 54 of parliament’s 329 seats.

He was followed by Amiri with more than 1.2 million votes, translating into around 47 seats, and Abadi with more than 1 million votes and about 42 seats. Former Prime Minister Nuri al-Maliki, a close ally of Iran like Amiri, came in fourth with around 25 seats.

The remaining uncounted ballots, mostly from Iraqis abroad, the security services, and internally displaced people voting in camps and elsewhere, might change the final seat tallies but only marginally.

Winning the largest number of seats does not automatically guarantee that Sadr will be able to hand-pick a prime minister. The other winning blocs would have to agree on the nomination.

Slideshow ( 9 images )

In a 2010 election, Vice President Ayad Allawi’s group won the largest number of seats, albeit with a narrow margin, but he was blocked from becoming premier for which he blamed Tehran.

NEW GOVERNMENT

A similar fate could befall Sadr. Iran has publicly stated it will not allow his bloc to govern.

“We will not allow liberals and communists to govern in Iraq,” Ali Akbar Velayati, top adviser to the Islamic Republic’s Supreme Leader Ayatollah Ali Khamenei, said in February.

His statement, which sparked criticism by Iraqi figures, was referring to the electoral alliance between Sadr, the Iraqi Communist Party and other secular groups which joined protests organised by Sadr in 2016 to press the government to see through a move to stem endemic corruption.

Slideshow ( 9 images )

Iraqi Communist Party Secretary General Raed Fahmy told Reuters the vote in favour of Sadr’s list, backed by his group, “is a clear message that we must have balanced relations with all (countries) based on non-interference in Iraq’s internal affairs”.

“Everybody is welcome to provide support to Iraq, but not at the expense of its sovereignty and independence,” he added.

During the campaign, frustrated Iraqis of all shades complained about their political elite’s systematic patronage, bad governance and corruption, saying they did not receive any benefits of their country’s oil wealth.

“This vote is a clear message that the people want to change the system of governance that has produced corruption and weakened state institutions,” said Fahmy.

Iraq has been ranked among the world’s most corrupt countries, with high unemployment, poverty, weak public institutions and crumbling infrastructure despite high oil revenues for many years. Endemic corruption has eaten at the government’s financial resources.

Fahmy told his party’s website that Abadi’s bloc was “closer” to Sadr’s than others.

BALANCING ACT

Sadr derives much of his authority from his family. His father, highly respected Grand Ayatollah Mohammed Sadeq al-Sadr, was killed in 1999 for defying Saddam Hussein. His father’s cousin, Mohammed Baqir al-Sadr, was killed by Saddam in 1980.

Celebrations erupted on the streets of Baghdad after the commission’s announcement, with thousands of Sadr’s supporters singing, chanting, dancing and setting off fireworks while carrying his picture and waving Iraqi flags.

Many chanted “Iran out”.

Whoever wins the election will have to contend with the fallout from U.S. President Donald Trump’s decision to quit the Iran nuclear deal, a move Iraqis fear could turn their country into a theatre of conflict between Washington and Tehran.

Abadi, a British-educated engineer, came to power four years ago after Islamic State seized a third of Iraq’s territory. He received U.S. military support that was helped the victory of Iraqi security forces over the Sunni militant group, and gave free rein to Iran to back Shi’ite militias fighting on the same side.

If parliament does grant him a second term, Abadi will remain under pressure to maintain the balancing act between Washington and Tehran.