The razor-thin victory of Ayad Allawi's alliance over the coalition headed by the incumbent prime minister Nouri al Maliki was remarkable, not least because Mr Allawi campaigned on a secular, nationalist platform. But it promises a messy transition in the coming months that will test the ability of Iraq's politicians to compromise within its fragile constitutional framework, and of its institutions to regulate, not to mention survive, the political wrangling.
The manner in which the results of the elections are certified, as well as whether Mr al Maliki opposes Mr Allawi through legitimate means (or resorts to sectarian emotions and holds on to the security apparatus), will go a long way in shaping Iraq's future politics. Mr al Maliki has threatened to contest the final results, and may make a deal with members of the Shia-dominated Iraqi National Alliance (INA) to boost his own alliance (an inventive but controversial reading of Iraq's constitution by the Supreme Court allows him to do so). That outcome would be similar to a player throwing the backgammon board into the air after losing the game and calling it a win.
It would ruin the principal achievements of these elections: the decision by a majority of the Sunni community to enter the political game and the decisive sidelining of elements that favour a protracted insurgency. Ironically, Mr Allawi benefited from the controversy over candidates who were banned for suspected ties to Saddam Hussein's Baath Party. It was his Sunni allies who were the most important casualties of the de-Baathification policy driven by the INA.
Once powerful Sunni leaders like Ahmed Al-bu Risha, the brother of the founder of the Awakening Councils that allied with the American troops to drive al Qa'eda out of the Sunni tribal areas, and members of the Tawafuq list, a major Sunni coalition, performed terribly in the elections. Apparently the Sunni community coalesced around Mr Allawi to back a single horse in Iraqi politics, even if he is not technically one of their own.
Mr al Maliki may be counting on the immense difficulty Mr Allawi will have forming a sustainable coalition. With 91 seats, Mr Allawi needs the support of at least 72 other MPs. As things stand, Mr al Maliki's State of Law controls 89 seats, the INA 70 and the main Kurdish coalition 43. Mr Allawi's big problem is that many Shias, politicians and private citizens see him as a Trojan horse that will return the Baathists to power. Also, Iran is not very keen to see him lead Iraq.
As the Sunnis' main ally, he faces Kurdish suspicion over promises he made to them over the fate of the disputed city of Kirkuk and his preference for a strong central government. Perhaps conscious of this, Mr Allawi has for the moment adopted the attitude of the magnanimous victor, saying that all government coalitions were possible, including a grand if unlikely alliance with Mr al Maliki. But despite Mr Allawi's predicament, Mr al Maliki is not in a position of strength to form a cabinet either. Even if he receives a mandate to form a government with INA support, his legitimacy will be tarnished and he will become even more dependent on the Shia coalition.
Given the profound acrimony between them, a deal with the INA would come at a significant price to his power. Indeed, in 2008, Mr al Maliki forced a conflict with the militia of Moqtada al Sadr, the leader of the INA's strongest bloc, who shrewdly accepted a military defeat and refocused on patronage politics among lower class Shias, a bet that paid off. In fact, the unpleasant truth is that any deal with the INA or its Sadrist faction will reward Iran's closest allies despite their disappointing electoral performance. Another irony is that Mr Allawi and Mr al Maliki, the apparent front-runners, may both end up sidelined in favour of a weaker candidate who will be beholden to kingmakers in the various coalitions instead of the Iraqi voters.
Iranian officials have disingenuously suggested that Saudi backing for Mr Allawi distorted the election results, but there is no denying that Arab officialdom cheered him on. Judging by the delighted tone of many Arab commentators about Mr Allawi's victory, the realisation hasn't dawned that narrow support for one horse to counterbalance Iran's gains since 2003 has come at the cost of reaching out to broader segments of Iraqi society.
Bad blood between Iraq and its neighbours persists. Last week, the Iraqi foreign minister stormed out of a preparatory meeting at the Arab League summit, after the Libyan host Muammar Qadafi met with exiled members of the Baath Party. Tellingly, it was the foreign ministers of Kuwait and Bahrain, two of the few countries that have reached out to Baghdad, who managed to temporarily patch things up.
The unfortunate, perhaps provocative, decision of the outgoing president, Jalal Talabani, to visit Tehran instead of attending the Arab League summit provided further evidence of the lack of trust between Iraq's new political class and its Arab neighbours. Iraq's Kurds, of which Mr Talabani is a prominent leader, are engaged in a tough fight to keep the presidency against the candidacy of the current vice president Tareq al Hashimi.
A Sunni ally of Mr Allawi, Mr al Hashimi has argued that Iraq as an Arab nation should be governed by Arabs. But it is doubtful that any horse-trading deal could end with both Mr Allawi and Mr al Hashimi in the top two positions. The outcome of Iraq's elections will undoubtedly disappoint and displease its people. But, as long as it does not invite more violence and does not preclude further elections, maybe Iraqis can reconcile themselves to their deeply imperfect democracy.