MUQTADA AL-SADR is a master at tapping Iraqi discontent. The firebrand Shia cleric (pictured) directed his supporters to attack the American troops who invaded Iraq in 2003. More recently he has led campaigns against corruption and foreign influence. His supporters ransacked government offices in 2016. And in the election on May 12th they gave his nationalist bloc, Sairoun (“Marching to Reform”), the most seats in parliament. Unofficial results put it unexpectedly ahead, with 55 seats.

The bloc led by Iraq’s mild-mannered prime minister, Haider al-Abadi, came second, with 51. A coalition led by Hadi al-Amari, the gruff commander of the Iranian-backed Badr Brigades, came third, with 50. The surprising result signals growing discontent with Iraq’s sectarian old guard. But it is unlikely to sweep it away.

It may yet take months to determine who has actually won the election. Claims of irregularities need resolving before results are final. Parliament then has to elect a president, who must ask the largest bloc to form a government. Then the real jostling for posts begins.

Mr Sadr, who cannot become prime minister because he did not run himself, is in a strong position to be kingmaker. Although his most ardent supporters are Shias in the shantytowns of Baghdad and Basra, he won by broadening his appeal. He joined up with communist and secular parties, wooed Sunnis by praying in their mosques and published a plan for reconciliation between Islam’s sects. Last year he went to Saudi Arabia to meet Muhammad bin Salman, the Sunni kingdom’s powerful crown prince.

His bloc would need to form an inclusive coalition if it is to govern. In a post-election tweet, Mr Sadr named Kurdish, Sunni and Shia parties as potential allies. But he left two staunchly Shia parties with strong ties to Iran off his list: the Badr Brigades, which represents a coalition of Shia militias, and Dawa, a Shia Islamist party led by Nuri al-Maliki, a former prime minister. They could yet spoil his chances.

Mr Amari may have failed to do as well in Iraq as his Iranian-backed counterpart, Hassan Nasrallah, the leader of Hizbullah, did in Lebanon’s recent election. But he still wields a lot of clout. His Badr forces dominate the interior ministry and fill the ranks of the federal police. He is close to senior Iranians, who have in the past worked behind the scenes to cobble together a government. And he has hedged his bets by meeting regularly with the American ambassador in Iraq.

Mr Amari’s natural ally is Mr Maliki, whose “State of Law” faction inside Dawa fared poorly, winning 25 seats. But Mr Maliki has influence over Mr Abadi, another Dawa stalwart. There are differences. Mr Abadi does not share Mr Maliki’s Shia chauvinism and has canvassed Sunni and Kurdish votes. Remarkably for a Shia, Mr Abadi’s list won Mosul, the Sunni stronghold once controlled by Islamic State (IS).

All this means that Mr Abadi may emerge as a swing player. By joining Messrs Amari and Maliki, he could restore the dominance of the fractured Shia house. However, if he teamed up with Mr Sadr’s Sairoun, he could put the country on a path towards less sectarian politics. Both camps suggest they may back Mr Abadi’s bid for a second term.

In contrast to previous ballots, the election passed off without serious violence. For the first time since Iraq’s transition to parliamentary democracy in 2005, Sunnis voted in large numbers for Shias. Party leaders of all hues curbed their sectarian barbs. But Iraqis are disenchanted. Only 44% voted, down from 62% in 2014. Their patience will be tested if their votes only perpetuate dysfunctional, corrupt rule.