The Iraqi prime minister, Nouri al-Maliki, was last night poised to lose power as final election tallies showed that Iyad Allawi, the secularist challenger, had won most seats in the 325- member parliament.
The results released yesterday by the country's election commission showed Mr Allawi's Iraqiya group winning 91 seats, narrowly beating the alliance led by Mr Maliki into second place with 89 seats. Potential coalition partners are thought hostile to any deals that would keep Mr Maliki in power. There is no guarantee that Mr Allawi, a former prime minister, will be able to form a ruling coalition either but the extent of his success is much greater than had been expected.
Violence marked the final day of election counting yesterday as two bombs in Diyala province killed 40 people and wounded more than 60. Iraq is not likely to return to the mass slaughter of recent years but the bloodshed underscored the ongoing political tensions.
In Baghdad protesters supporting Mr Maliki backed his call for a recount of the 7 March poll and waved banners reading "No, no to fraud!" and "Where have our voices gone?" But the Independent High Electoral Council has denied allegations of widespread fraud and rejected demands for a manual recount. The UN's top representative in Iraq, Ad Melkert, also declared that the results were credible and urged all sides to accept them.
Iraqi leaders will now play an elaborate game of political chess as they negotiate over the next four or five months on how power is to be shared and who will form the next government. The two front runners – the State of Law and Iraqiya – will look for coalition partners among the other two important political groupings. These are the Kurds with about 42 seats and the Iraqi National Alliance (INA) – grouping together two Shia religious parties, the Islamic Supreme Council of Iraq (ISCI) and the followers of the anti-American Shia cleric Muqtada al-Sadr – with around 70.
The election campaign saw sectarian hatred deepen between Shia and Sunni. Sunni leaders were banned from running as parliamentary candidates at the last moment because of alleged past membership of the Ba'ath party. Mr Maliki abandoned his previous nationalist and non-sectarian rhetoric in order to appeal to core Shia voters. State of Law media outlets denounced Mr Allawi as a CIA puppet linked to Saddam Hussein who was not even properly Iraqi because of his Lebanese mother.
Despite this, many Shia must have voted for Mr Allawi, particularly in Baghdad, but overall Iraqis voted as in the past along sectarian and communal lines. Mr Allawi, though himself a secular Shia, owed his election success largely to wholesale backing from the Sunni Arabs who make up about a fifth of the Iraqi population. Either Mr Maliki or the INA headed the poll in the provinces where there is a Shia majority, while the Kurds voted for Kurdish parties within the area ruled by the Kurdistan Regional Government.
While the election has showed that Iraq is divided and even unstable, this does not necessarily imply there will be a return to the violence of 2003-7. The last parliamentary election of December 2005 was boycotted by many Sunni who supported armed insurrection against the government and the US occupation.
This year the Sunni participated even more strongly than the Shia. "One of the main features of this year's election is the return of Sunni self-confidence," said the Iraqi commentator Ghassan Attiyah. Having demonstrated their political strength at the ballot box it is unlikely the Sunnis will resort to armed struggle again.
The other Iraqi group which resorted to armed force after the US invasion was that of Moqtada al-Sadr, who fought the Americans in Najaf in 2004, and whose Mehdi Army killed thousands of Sunni in the Sunni-Shia civil war of 2006-7. But the Sadrists did spectacularly well in the election, winning some 40 seats while ISCI, their partners and former rivals, did badly. In the wake of their success the Sadrists have no incentive to revive their militia.
An unexpected aspect of Mr Allawi's triumph north of Baghdad is that Iraqiya has done particularly well in the provinces centred on Kirkuk and Mosul against the Kurdish parties. This will be a blow to the Kurds, undercutting their claim to the city of Kirkuk and Kurdish parts of Nineveh province of which Mosul is the capital.
But Mr Allawi's reliance on Sunni Arabs from these contested areas will make it difficult for him to have an alliance with the Kurds which he would need to form a government. "The Kurds have no problem with Allawi, but a lot with his allies," says Kurdish commentator Kamran Karadaghi.
Mr Maliki has a different problem with the INA which is discussing a merger with his own State of Law bloc. Both are overwhelmingly Shia, but the INA – and above all the Sadrists – want the ousting of Mr Maliki, whom they see as having betrayed them when he attacked the Mehdi Army in 2008. Mr Maliki has also been at odds with the Kurds since he took a hard line in resisting their demands in northern Iraq for districts they regard as traditionally Kurdish.
It is unlikely that Mr Maliki and Mr Allawi could form a coalition because they personally dislike each other and it is doubtful if the Shia majority would allow their post-Saddam Hussein predominance in Iraq to be diluted. It is more likely that the State of Law coalition will look for a new candidate to be prime minister, probably from Mr Maliki's Dawa party.
The strength of Sunni Arab participation in the election means any new government will have to include more Sunnis than in the past.
The foreign powers which back the different parties all have reasons to be pleased. The Americans have seen an election take place which will enable them to withdraw on schedule. Saudi Arabia and the Sunni states are satisfied with Mr Allawi's strong showing and the Iranians' allies have done well enough to determine the shape of the next Iraqi government.
Iyad Allawi: From puppet to player
Five years ago he was denounced as an American puppet, but Iyad Allawi, the former Iraqi prime minister, is set for a surprising return to the centre-stage of Iraqi politics following the elections. When he was Prime Minister in 2004-05 his government was attacked as corrupt and dysfunctional. He himself concedes he could do little without the assent of US officials.
Born in 1945 as a member of a rich Shia commercial family, Mr Allawi was a member of the Ba'ath party until the 1970s. After moving to Britain in 1970s to train as a doctor he broke with Saddam Hussein and was almost killed in London by an axe-wielding assassin sent by the Iraqi leader in 1978.
He presented himself thereafter as an opponent of Saddam Hussein who was secular, nationalist and sympathetic to former Ba'athists. He helped organise an attempted military coup in Baghdad in 1996 which failed disastrously.
In the aftermath of the US invasion he returned to Iraq and headed an interim government that was appointed by the US and failed to prevent the country sliding into extreme violence. Having fared poorly in the parliamentary election of 2005, Mr Allawi spent most of the subsequent years out of Iraq.
He owes the success of his al-Iraqiya coalition in the latest polls to the support of Sunni Arabs. This has led to it triumphing in five out of 18 provinces. Though Mr Allawi is himself a Shia, the Sunni see him as non-sectarian and secular in contrast to the other two main Arab coalitions which are dominated by Shia religious parties.
He also enjoys the advantage of being backed politically and financially by Sunni Arab states led by Saudi Arabia with whom he has close relations. He retains a close alliance with the US and Britain who in the past have promoted him as the Iraqi leader to whom they are most sympathetic.
He is unlikely to become Prime Minister again because the Shia or Kurdish majority would probably not accept him as leader, but they will be unable to ignore his success and will try to include part at least of his coalition in the next government.