When Iraqi forces swept into Kirkuk on Monday, wresting control from the Kurdish peshmerga who had seized the city in 2014, it was a stunning rollback of Kurdish territorial expansion, and a spectacular defeat of Kurdish aspirations for independence.
The Iraqis followed up their success the following day by moving into peshmerga-held territory all along the border of the autonomous Kurdish region. When the dust settled, it was clear that Kurdish president Masoud Barzani's attempt to leverage the Kurds' high international standing into an independent Kurdistan had failed.
Faced with this disastrous setback, Mr Barzani and his allies unconvincingly tried to portray the Kurds as victims of Iranian aggression. In truth, the Kurdish push for independence that kicked off the Iraqi advance was marred by naked expansionism based on flimsy justifications and dubious methods that contrasted sharply with the image the Kurds had crafted during three years of fighting ISIL.
To the West, the Kurds became the poster boys of the war on ISIL. The Kurdish autonomous region was seen as a stable, modern, democratic and tolerant oasis in a country torn apart by a vicious sectarian conflict.
It was an image their leaders cultivated carefully and used to their advantage. Mr Barzani and his Kurdistan Democratic Party (KDP) in particular came to see the war as an opportunity.
Soon after Iraqi forces retook the city of Mosul from ISIL after nine months of bitter fighting, putting an end to the existential threat the terror group posed to the country, Mr Barzani went ahead with a controversial referendum on independence from Iraq.
The referendum was greeted with enthusiasm by most of the roughly five million Kurds in the autonomous region. The Kurds had suffered grievously at the hands of the Saddam regime, and an independent Kurdistan has been the dream of Kurds in Iraq, Turkey, Iran and Syria for generations.
Mr Barzani hoped that a favourable result would boost his hand in negotiations with Baghdad over secession, and convince the international community of his cause.
The referendum was held on September 25, and official results showed that 93 per cent of participants had voted "yes" on independence.
It seemed that the people had spoken; who would now want to deny the Kurds their own country?
Almost everyone, it turned out.
________________________
Read more:
Iraqi Kurdistan welcomes Baghdad's dialogue initiative to resolve conflict
Abadi presents calm face after Kurdish collapse
Dana Gas, Genel say Kurdistan oil production yet to be disrupted
________________________
Fearing that an independent Iraqi Kurdistan would embolden their own Kurdish minorities, Turkey and Iran condemned the referendum from the outset and immediately began to work with Baghdad to rein in the Kurds. The United States and European powers also stressed that they wanted to maintain Iraq's territorial integrity.
The central government was now free to turn the screw on the hapless Kurds. Calling on the Kurdish Regional Government (KRG) to renounce the referendum, Baghdad enforced a ban on international flights from Kurdish airports and threatened to close the land borders.
But there was more to come. Baghdad's fury centred on the KRG's decision to include in the referendum vast swathes of territories that were claimed by both the Iraqis and Kurds, and which had fallen to the Kurds during the war on ISIL, or through previous land grabs. The main bone of contention was the oil-rich city of Kirkuk, which the peshmerga had seized after the Iraqi army fled in 2014.
The Kurdish claim to Kirkuk is rooted in history, but is legally spurious. Situated outside the autonomous zone, it lies on sovereign Iraqi territory and is ethnically mixed, with Arab, Kurd and Turkmen inhabitants.
The Kurds say the ethnic composition of Kirkuk, and of the other disputed territories, was altered by the Arabisation policies of Saddam Hussein, and that the city should be considered Kurdish regardless of the current population mix.
Iraq's 2004 constitution addresses Saddam's ethnic tinkering: Article 140 of the constitution calls for a reversal of Kurdish expulsion from the disputed territories, followed by a census, and a referendum to decide whether they should fall to the Kurdish region. But these measures were never implemented, and there is no clarity over the ethnic composition in those areas, nor the desire of their populations to join the Kurdish region, lets alone an independent Kurdistan.
September's referendum cannot be seen as valid expression of the popular will in Kirkuk and other disputed areas. The voting process was not transparent, with reports suggesting that people were strong-armed into voting "yes", and that multiple votes were cast by proponents of independence.
Since the referendum results were not clearly broken down by area, it is not known how the disputed territories voted.
To pander to US fears of a growing Iranian influence in the Middle East, the KDP and the media outlets it controls released a slew of statements and reports purporting that the Iraqi forces deployed were almost exclusively Shiite militias, who are controlled by Iran.
But the suggestion that the move on the disputed areas was an Iranian takeover is a red herring. The Hashed Al Shaabi, or Popular Mobilisation Units, do indeed have close ties to Iran, and divided loyalties. But they have been part of the Iraqi forces that defeated ISIL in three years of hard fighting, and were acting in conjunction with special forces and army units, and under the strict instructions of Iraqi prime minister Haider Al Abadi.
The truth is more inconvenient for the Kurds: President Barzani overplayed his hand by calling the referendum. He misjudged the reaction of longtime allies such as the US and Turkey. By reaching for territories that the Kurds have no legal claim to, he undermined the standing they gained for their part in defeating ISIL. By prompting Baghdad to take resolute action on the disputed territories, he plunged the Kurdish region into deep crisis, creating internal rifts that will poison Kurdish politics for years, and make independence more unlikely than ever.