Baghdad - Final results from Iraq's election confirmed Saturday that an alliance spearheaded by populist cleric Moqtada Sadr has triumphed, but the fiery preacher faces a huge task to form a governing coalition.

Sadr's Marching Towards Reform bloc won 54 of the 329 seats in parliament in a major upset at a May 12 vote that saw a record level of abstentions as Iraqis turned their back on a widely reviled elite.

The nationalist - whose Shia militia battled US troops after the 2003 invasion - faces a deeply fragmented political landscape and opposition from key player Iran after he called for foreign influence in Iraq to be cut.

Sadr, who has reinvented himself as an anti-corruption crusader in an alliance with secular leftists, is looking to be the kingmaker and oversee the formation of a cross-sectarian, technocrat government from some dozen parties.

But negotiations - which tentatively began after the vote - look set to drag out and it remains far from certain that Sadr's group will claim power after the first vote since the defeat of the Islamic State group.

Poised in second place with some 47 seats is the pro-Iranian Conquest Alliance made up of ex-fighters from mainly Shia paramilitary units that battled IS.

The Victory Alliance bloc of Prime Minister Haider al-Abadi, who hoped voters would reward him for seeing off the jihadists, performed worse than expected and was back in third place on 42 seats.

Regional tensions

Sadr declared on Twitter that the results showed "reform has won and corruption is weakened," but he faces a tricky regional context as he begins coalition negotiations.

Writing in The Washington Post Friday, premier Abadi insisted his government would do "all it can to ensure that the transition to the next government is conducted in a stable and transparent manner". He called for "dialogue" to create a new government that "must be demonstrably non-elitist (and) representative of the people rather than dominated by one side or denomination".

Abadi - who came to power in 2014 as IS rampaged across Iraq - has balanced off rivals the US and Iran and could still remain in position as a consensus candidate.

The protracted horse-trading comes at a time of high tensions after Washington's withdrawal from a landmark nuclear deal with Tehran and fears of a tug-of-war over Iraq.

Even before Sadr's victory was confirmed, Iran had already been convening meetings to try to block him from forming a government.

Iran dispatched the powerful general Qassem Soleimani to Baghdad, who has met with several members of Iraq's old guard including Abadi and his predecessor Nuri al-Maliki.

According to officials, Soleimani has ruled out any alliance with Sadr, who surprised many last year by visiting Iran's regional foe Saudi Arabia as Riyadh seeks increased involvement in Iraq.

Soleimani's shuttle diplomacy is aimed at gathering enough parties opposed to Sadr to deny his alliance a governable majority and a route to the powerful position of prime minister - though Sadr himself says he is not in the running for the top job. The US, which still has thousands of troops in Iraq from the fight against IS, is also looking to push its interests after the vote.

Washington envoy Brett McGurk has been meeting with leading politicians in both Baghdad and the autonomous Kurdistan region to the north. Attracting the Kurds and the marginalised Sunni community will prove important for anyone seeking to come to power, as Iraq looks to carry out the mammoth task of rebuilding after the defeat of IS.

Sadr "will probably try to form a large coalition, including Shia parties, potentially involving the list of Abadi, and the Sunnis and Kurds", said Raphaele Auberty, an analyst at London-based BMI research.

Fiery cleric who battled US

Moqtada Sadr is the scion of an influential clerical family who raised a rebellion after the 2003 US invasion of Iraq and has now reinvented himself as a reform champion to triumph at elections. After the toppling of Saddam Hussein his militia fought fierce battles with American troops and he was identified by the Pentagon in 2006 as the biggest threat to stability in Iraq.

But after years on the sidelines, Sadr linked up with secularists with a promise to battle corruption and now appears to hold the keys to Baghdad. The nationalist cleric's Marching Towards Reform alliance came out on top in Iraq's parliamentary elections earlier this month.

"Sadr - often dubbed a firebrand cleric - has come a long way from the days in 2003 when he was an outcast and a hunted man," said Nabeel Khoury, from the Atlantic Council think tank.

The election success follows three years of weekly protests, with Sadrists rallying alongside communists to call for an overhaul of the political class. While Sadr has ruled himself out of becoming prime minister, he should become kingmaker and aims to form a technocratic government from a dozen parties. Such a victory over internationally favoured prime minister Haider al-Abadi came as a surprise, but Sadr is well-known to Iraqis and US forces alike.

Militia army

His rise to political power has been aided by the reputations of two famed relatives - including his father, Grand Ayatollah Mohammed Mohammed Sadiq al-Sadr - killed during Saddam Hussein's rule. Sadr gained widespread popularity in the months after the 2003 invasion of Iraq. His Mahdi Army - estimated to have had up to 60,000 members - was once the most active and feared armed Shia group in the country, and was blamed by Washington for death-squad killings of thousands of Sunnis.

But in August 2008, Sadr suspended the activities of the Mahdi Army after major US and Iraqi assaults on its strongholds in Baghdad and southern Iraq.

Following the ceasefire, US military commanders said Sadr's action had been instrumental in helping bring about a significant decrease in the levels of violence across Iraq.

He nonetheless continued his vocal opposition to the US military presence in the country.

Holding onto the street

Despite repeatedly bowing out of politics, reportedly pursuing religious studies in the Iranian holy city of Qom, he remained able to pull powerful political strings.

After throwing his weight behind Shia politician Nuri al-Maliki in 2006, ensuring he became prime minister, Sadr then ordered his followers to pull out of the cabinet the next year, almost bringing down the government.

Sadr's bloc contested the 2010 legislative election in an alliance with the Supreme Iraqi Islamic Council, another Shia group with links to Iran.

The inconclusive polls saw Maliki gain a second term as premier - during which he was deemed a "dictator" by Sadr who called for his resignation.

More recently the former commander renewed his militia to defend Iraqi religious sites in 2014, after the Islamic State group overran large areas north and west of Baghdad.

Whether on a military, clerical or political path, Sadr has been careful to maintain the power base which has now given him an unrivalled level of political influence.

"Because he holds onto the street, he upsets numerous parties," said Iraqi political expert Essam al-Fili. For the analyst, forming a coalition government with Sadr would result in "the political situation entering a phase of instability".