WHEN a leader loses half his realm and his government’s main source of revenue and shatters his people’s dreams of independence, all in a couple of days, an apology might seem in order. But Masoud Barzani, the president of Iraq’s Kurdistan region, is not offering one. In the face of a lightning Iraqi advance, Kurdish forces retreated this week from territory they had occupied since the fall of Saddam Hussein in 2003. Mr Barzani blamed “traitors” and said he would fight another day.

The sudden collapse of Kurdish Peshmerga fighters, and with them the Kurds’ cherished dream of statehood, contrasts awkwardly with the inflated promises Mr Barzani made before the rout. Last month he insisted on staging a referendum on Kurdish independence, not just within the Kurdistan region’s original borders, but also in areas his forces had captured in the war against the so-called Islamic State (IS) since 2014. These included the oil-rich city of Kirkuk, which would have been the cash cow of a Kurdish state.

Western allies, neighbours and many fellow Kurds had begged him to desist. Mr Barzani upped his brinkmanship. At the funeral of Jalal Talabani, Iraq’s former president and Mr Barzani’s erstwhile Kurdish rival, the following week, he draped Mr Talabani’s coffin in a Kurdish flag, played the Kurdish anthem and derisively seated Iraqi dignitaries from Baghdad towards the back. When Turkey, Iran and Iraq all sent their tanks to his borders to press him to back down, he dismissed the moves as posturing. What was won in blood would be defended in blood, he averred. Even if hundreds of thousands died, added his officials, the Kurdish state would be born.

It was puff. After midnight on October 16th Iraqi government forces began marching on Kirkuk. By breakfast they had taken the city’s airport, its main military base and its largest oilfields. They lunched in the governor’s office in the heart of the city, together with the newly appointed interim governor, an Arab. On the second day they ploughed past more Kurdish trenches and wrested back some 36,000 sq km (14,000 sq miles). By October 18th Iraqi forces controlled most of the Kurds’ southern flank, from the town of Rabia on the Syrian border, via the strategic heights of Sinjar and Mosul’s dam across the Tigris to Khanaqin on Iran’s border (see map).

Casualties were remarkably light. A few Kurds took up arms in Kirkuk, vainly shooting their rifles. But most Peshmerga fled for the hills, together with some 60,000 civilians, past the unseeing eyes of a 21-metre-high statue of a Kurdish fighter that was recently erected on Kirkuk’s northern edge. With them went the prospects of statehood. The Kurdish region was already broke. Without Kirkuk’s 300,000 barrels of oil per day (providing roughly half of the Kurdish government’s revenues), it cannot hope to be viable. Militarily, the Kurds look a shambles. And politically their institutions are hollow. When his term in office expired in 2015, Mr Barzani suspended parliament and ruled like an autocrat. In the wake of the rout, Mr Barzani’s men put elections on hold, indefinitely. With no democratic means of replacing Mr Barzani, the Kurdish enclave is at risk of dissolving once more into competing fiefs, as it did during a civil war in the 1990s. Rival clan leaders accuse each other of betrayal. The Barzanis “fought for oil; we fought for soil,” says Lahur Talabani, the head of one of the enclave’s two intelligence agencies and a contender to succeed his uncle as leader of the eastern fief. The Talabanis committed “a great and historic treason against Kurdistan”, retorts Nechirvan Barzani, Masoud Barzani’s nephew and the Kurdish prime minister. A plague on both your houses, say many Kurds. Whereas the Kurdish government is in tatters, Iraq’s Shia-led one has revived. In quick succession it has crushed one group of separatists (the barbaric IS) and hobbled another (the Kurds). Its army is battle-hardened. The northern oilfields it now controls will allow it to boost production and raise more cash. Thanks to the military victories, Haider al-Abadi, the Iraqi prime minister, looks well-placed to win a second term in 2018. His American backers hope that he will build a pluralist, non-sectarian Iraq. Certainly, Iraq’s Shia leaders have refrained from triumphalist bombast. They talk of inclusion, not liberation, and say they will halt their advance at the borders of the original Kurdish region. They are proposing a joint administration in the territories from which the Kurds have been ousted. In Kirkuk, they will leave the local police, led by a Kurd, in charge. There have been few reports of revenge killings or looting. Turkomans in Kirkuk even rallied to protect Kurdish homes. Most Kurds who fled have returned home, says the UN.

Yet the ethnic goodwill could fray again. To Kurdish chagrin, some Arabs and Turkomans cheered the arrival of Iraqi tanks as they filed past Kirkuk’s ancient citadel. Footage of government troops pinning Shia flags to government buildings in Khanaqin makes them shiver. And though broken for now, the Kurds might yet rally, should Baghdad’s authorities seek to impose direct rule on the reduced Kurdish enclave. Kurds have governed themselves since 1991. Two generations have grown up without bowing to Baghdad or even bothering to learn Arabic.

Mr Abadi’s armed Shia rivals also hope to profit from victory. The Shia Popular Mobilisation, or hashd, feels emboldened. Two of its leaders stood alongside army generals as they raised Iraq’s flag over Kirkuk. Some urge Mr Abadi to demobilise them before he loses control, but Mr Abadi shies away from confrontation. “After the election,” suggests a minister.

Iran also looks stronger. Qassem Suleimani, the head of the Quds Force, the foreign operations arm of Iran’s Islamic Revolutionary Guards Corps, shuttled between Sulaymaniyah and Baghdad mediating Kurdish capitulation and advising Iraqi commanders on their assault. Remarkably, given that it arms and trains both Iraq’s army and Kurdish forces, America kept silent. For all his grandiose promises to roll back Iran, Donald Trump looked like a bystander. In Kirkuk, Iran called the shots.