Not much more than a month ago, Iraqi Kurdistan's leaders seemed sure that their path to independence was all but guaranteed.
The autonomous region controlled swathes of disputed territory once administered by the federal government in Baghdad, including vast oil reserves and energy infrastructure.
Its armed forces, known as Peshmerga, enjoyed a formidable reputation and had cooperated closely with the US and other powerful allies in the fight against Islamic State. The way, they thought, was clear.
But on Monday October 16, Iraqi government forces ousted Peshmerga from the disputed city of Kirkuk along with nearby oil fields that the Kurdistan Regional Government (KRG) had counted on for revenues to sustain an independent state.
The defeat came shockingly fast and prompted a disorderly retreat from other territories that KRG president Masoud Barzani had pledged would never be returned to Baghdad.
It was a rout that blindsided many of Iraq’s Kurds and left their long held dream of secession in tatters. In the regional capital of Erbil, officials, soldiers and civilians alike are still struggling to come to terms with this profound humiliation.
“The Kurdish community never expected such a reaction from the Iraqi government,” said Alan, 26, who asked that he be known only by his first name. “We didn't expect them to attack us and take Kirkuk by force, it has become like a siege now.”
The crisis was largely impelled by last month's controversial independence referendum, which faced near-universal opposition.
Neighbouring Turkey and Iran found a rare moment of unity to agree retaliatory counter-measures, while Iraqi Prime Minister Haider al-Abadi threatened military action if the results were not annulled. Even allies — with the exception of Israel — begged the KRG to postpone or cancel the vote, for fear it would destabilise the entire region.
But Mr Barzani pressed on, seemingly confident the results would trigger secession talks in which they would hold a major advantage.
That now appears to have been a miscalculation of epic proportions. Voting went ahead as planned on September 25 and results reflected an overwhelming desire to leave the rest of Iraq.
The backlash was rapid. At first, Baghdad chipped away at existing aspects of autonomy by banning international flights from landing in the region and demanding control of oil exports.
Eventually though, Mr Abadi made good on his threats. Soon after retaking Kirkuk he called for a return to talks. “The illegal referendum is over, its results invalid and belongs in the past,” he said on Twitter. “We call for dialogue based on Iraq’s national constitution.”
A return to the negotiating table now seem to be the only option open to Mr Barzani, though he will be in a far weaker position than before.
Saudi oil minister Khalid al-Falih made a high-profile visit to Iraq on Saturday, as the countries begin strengthening ties in the sector and frosty relations between the countries thaw. On the same day, Mr Abadi left Baghdad for a visit to Saudi Arabia.
Over the weekend, angry protestors in Erbil waved Kurdish flags outside the US embassy and UN consulate, some carrying signs saying, "We need our country". People outside the Iranian consulate cheered as a man tore down its flag.
The Kirkuk crisis has bred widespread resentment and acrimony and not just between the two rival governments. Iraq’s Kurds now see betrayal from every side.
Control of the Peshmerga is split between Iraqi Kurdistan’s two largest political factions, Mr Barzani’s ruling Kurdistan Democratic Party (KDP) and the Patriotic Union of Kurdistan (PUK).
It was the PUK that first withdrew from Kirkuk after making an Iran-backed deal with the Iraqi government forces, although KDP peshmerga subsequently retreated too.
Nevertheless, KDP officials and media outlets wasted no time in labelling the PUK traitors. Even Mr Barzani, who a week later, still has yet to make a public appearance since losing the city, blamed “persons within a certain internal political party of Kurdistan” in a statement.
Others are less circumspect. “The Peshmerga sold us out, it was a PUK leaders, they made a deal for the whole of Kirkuk,” said Dana, 25, a student from the city.
PUK officials and followers have in turn levelled accusations of graft and egotism at the KDP while criticising Barzani for forcing through the referendum. “This is Barzani’s fault, because he asked for a country and his soldiers can’t even fire two bullets,” said one Erbil resident, who asked not to be named for fear of repercussions.
The crisis revealed deep-seated Kurdish rivalries, said Chatham House fellow Renad Mansour. “This showed the disunity of the Kurdistan region not only as a sub-state but with Peshmerga loyal to political parties and even individuals.”
Divided and isolated, Iraq’s Kurds now feel abandoned by even their staunchest allies. The US has been slow to react to both the referendum and crisis in Kirkuk, at first describing clashes between Iraqi and Kurdish forces that killed nearly 30 people as a “misunderstanding.”
And when government troops pushed Peshmerga out of the fringes of Kirkuk province on Friday, a statement from the Kurdish General Command made sure to highlight that they faced “American weapons that have been supplied to the Iraqi Army”.
For Baran Abdullah, 25, a Peshmerga fighter whose unit recently retreated from the disputed town of Makhmour, the US was no longer a friend.
“We don’t trust Americans anymore and we don’t need them anymore,” he said angrily. “We are finished with them.”