The trial of strength between the Iraqi government and the Kurds over control of Kirkuk is an explosive issue. Its ingredients are the fractured politics of the Kurds, fears of the rising influence of Iran in the region at the expense of the United States, and the embarrassing development of two US-supplied and trained armed forces confronting each other.
Any missteps in handling the issue could derail the chances of Iraq taking advantage of the destruction of ISIL’s so-called caliphate to make a fresh start.
This is a time when just about all forces on the ground in Iraq and Syria should be celebrating the liberation of the Syrian city of Raqqa, ISIL's headquarters, by the US-backed Syrian Democratic Forces, a mainly Kurdish outfit, which was chosen by Washington to spearhead the attack.
Instead, the Iraqi army and its Shia militia auxiliaries have been diverted from the anti-ISIL fight in order to drive their former allies, the Kurds, from the disputed city of Kirkuk, the hub of Iraq’s northern oil fields.
It is all too common for allies to turn on each other when their common enemy is defeated. But in this case, the split has occurred even before victory. This has raised fears that the remnants of ISIL may escape and regroup.
Read more on the Iraq-Kurdistan crisis
The blame must lie with Masoud Barzani, the president of the Kurdish autonomous region of northern Iraq, for calling an independence referendum last month in defiance of the wishes of all his neighbours and the external powers.
The Americans, who have sponsored Kurdish self-rule in northern Iraq since the 1990s, made no serious effort to stop the referendum going ahead, even though Turkey was confidently expecting this.
The absence of a guiding American hand reflects the disarray in Washington, where events are viewed solely in terms of the physical destruction of ISIL.
Mr Barzani's idea of a referendum was a clear sign of his own domestic political troubles – he has effectively silenced the parliament and extended his presidential mandate and has been looking for a popular boost for his Kurdistan Democratic Party.
The Kurds, who were promised a state at the end of the First World War that never materialised, voted overwhelmingly for statehood, even if wiser heads understood that this was likely to be an empty gesture, given that all the putative state’s neighbours with Kurdish minorities have an interest in crushing it.
Mr Barzani probably thought that his Kurdish fighters, known as Peshmerga, were a match for the Iraqi army – it was after the army fled in disarray before the ISIL onslaught of 2014 that the Peshmerga managed to seize hold of Kirkuk.
In fact, Mr Barzani's dream of statehood lasted only three weeks. When the Iraqi army moved on Monday to restore Kirkuk to Baghdad's control, they found a willing ally in the fighters of Mr Barzani's opponents, the Patriotic Union of Kurdistan, who withdrew by agreement. In essence, the PUK would rather share Kirkuk with the Baghdad government than have it under the control of Mr Barzani. Memories of a civil war in the 1990s between the two parties, in which Mr Barzani summoned Saddam Hussein's troops to crush the PUK, are still vivid.
Mr Barzani’s allies have accused the PUK of treachery, but the bitter truth is that a proto-state with two such bitterly opposed factions is not ready for independence.
Washington has remained studiously neutral in the contest between the Iraqi state and the Kurdish region. Donald Trump said: “We’re not taking sides but we don’t like the fact that they are clashing” – a less than adequate response when Washington could have stopped the referendum happening.
Washington has preferred to see the Kirkuk crisis not as a function of its own indecision but as a new power grab by Iran. This is based on the fact that the almost bloodless takeover of Kirkuk was facilitated by the Iranian Quds force commander, Gen Qassem Suleimani, who is the ringmaster of Iran's expeditionary forces in the Arab world.
More on the region in Opinion
But in this case it is too easy to blame him. If the US is a bystander, other powers will step in.
The Baghdad government was always going to reclaim Kirkuk after Mr Barzani had included the disputed territory in his referendum, thereby signally that it should be part of the proposed Kurdish state. The Kurds are believed to be the biggest community in the city, but they share it with significant communities of Arabs and Turkomans. If Haider Al Abadi had failed to retake Kirkuk after the referendum, his chances at next year's elections would have been slim indeed.
In the hierarchy of US interests, the territorial integrity of Iraq must surely come before the aspirations of the Iraqi Kurds, even though their kinsmen across the border are working closely with the US military. The region needs a strong Iraq, and one where all communities, especially the Sunnis, feel they have a stake. In its weakened state, it will always be subject to excessive Iranian influence.
If the Americans want to bolster the Iraqi state, they need to set out a plan for the future of Kirkuk under which it will be shared between Baghdad and the Kurdish autonomous region.
This is no easy task, but in the short term the problem is not insoluble. The Baghdad government has no way to export oil from the Kirkuk fields – it will have to go through the Kurds’ pipeline, which opens the possibility of a revenue-sharing agreement.
Having disastrously overplayed his hand over Kirkuk, Mr Barzani is short of revenue and friends. Turkey, which controls the Kurdish region's access to the outside world, has an interest in teaming up with Baghdad to keep the national aspirations of the Kurds under control. The delirium of the referendum result now seems like ancient history.