“They are like the Mongols,” says Najmaldin Karim, speaking of the forces of Islamic State (Isis) battering at the defences of the oil province of Kirkuk, of which he is governor. They have not broken through and he is confident they will not do so, but the threat they pose and the fear they cause is the dominant feature of life even in those parts of northern Iraq they did not conquer last year.

In terms of the terror that Isis inspires through the savagery of its actions, it does indeed have much in common with the Mongolian horsemen who destroyed Baghdad and slaughtered its inhabitants in 1258. Isis similarly cultivates an atmosphere of fear among its enemies, so that the Iraqi army disintegrated when Isis forces stormed Mosul last June and much the same thing happened when they attacked the supposedly more resolute Iraqi Peshmerga in Sinjar and Nineveh Plain a few months later.

The swift victories of Isis at that time gave the impression of a demonic and unstoppable force. In the eyes of Isis leaders, military successes far beyond what they had expected simply affirmed that they were carrying out God’s work and had divine support. Less attention was given to the weaknesses of the states and armies which Isis had so easily defeated. But it is on their ability to learn from past failings that the outcome of the war now being fought in Iraq and Syria will be determined.

Criticism of Isis’s opponents and their dismal performance on the battlefield has mainly focussed on the Baghdad government. There is no doubt that its corruption and sectarianism played into the hands of Isis. Less attention is given as to why the military forces of the Kurdistan Regional Government (KRG), supposedly far tougher and better commanded, fled from the Isis attack in August even faster than the Iraqi army in June. Yazidi villagers from Sinjar and Christians from the Nineveh Plain complain bitterly that they were abandoned by Peshmerga units whom only hours earlier had sworn to defend them to the last drop of their blood. It was one of the most shameful defeats in history.

The KRG has always got a better press than the Baghdad government, particularly since its oil boom got under way in the past five or six years. It presented itself as “the other Iraq”, which functioned properly, and Kurdish leaders invariably disparaged the central government in Baghdad as crooked and dysfunctional. They pointed to new five-star hotels, shopping malls, roads, bridges and apartment buildings sprouting on every street in Irbil, the Kurdish capital. There was a boom town atmosphere, and there were very few places on earth of which this could be said in the wake of the financial crash of 2008. Delegations of foreign businessmen, many of whom could not have found Iraqi Kurdistan on the map a couple of years earlier, poured into Irbil. Local managers complained that they could not find rooms for them despite all the new hotels. It seemed to go to the heads of Kurdish leaders who spoke of KRG becoming like an oil state in the Gulf, a landlocked version of Dubai.

Visiting KRG a couple of years ago, I felt that it was alarmingly similar in mood to Ireland pre-2008 at the height of the Celtic Tiger boom. The Kurds and the Irish are both small nations who feel they have been hard done-by throughout their history. Now they had thrown off foreign oppression and were getting rich like their neighbours. In Irbil as in Dublin it was a feeling conducive to delusion and a belief that “the Kurdish tiger” would bound forward for ever.

What those plane-loads of over-optimistic foreign government ministers and businessmen never understood was how fragile all this was. There was more in common between the ways in which the KRG and the rest of Iraq were ruled than they imagined. The Kurds depended on their 17 per cent share of Iraq’s oil revenues to pay the one in three of the labour force that worked for the government. Corruption was rife. A friend told me that he lived in part of Irbil surrounded by director generals working for the government: “I have a higher salary than any of them, but they have houses three times bigger than mine.” One Kurdish woman told me: “I call it ‘Corruptistan’.” For all the new five-star hotels, it was difficult to find a good school or hospital.

KRG was always flattered by any comparison with Baghdad. “Ease of doing business in Irbil compared to Baghdad is very good,” a businessman told me in early 2013. “Compared to the rest of the world it is rubbish.”

What really made Iraqi Kurdistan different from the rest of Iraq was that security was good, and it felt safe. Kurds and foreigners alike never seemed to look at a map and notice that they lived an hour’s drive from some of the most violent places on the planet. Mosul is only 50 miles from Irbil and has never been other than an extraordinarily dangerous city since 2003.

The belief that Iraqi Kurdistan is the safe part of Iraq was punctured when Isis captured Mosul last June. Even then, the Kurdish leadership deluded itself that what had happened was a Sunni-Shia battle in which they could stay on the sidelines and even benefit by opportunistically taking over Arab-Kurdish disputed areas. In August, they discovered they had made a calamitous error when Isis launched an ambitious offensive that came close to capturing Irbil. The United States and Iran rushed to help, while the KRG’s new ally, Turkey, found itself unable to.

ORDER IT NOW

Irbil today looks like Pompeii or Herculaneum in which a sudden disaster – in the Kurds’ case military rather than volcanic – has frozen all activity. The city is full of half-completed hotels, shopping malls and apartment buildings. Some of these are crammed full of refugees living in huts provided by the UN High Commission for Refugees. These are the people who are paying the price for the Kurdish leadership’s delusions of grandeur and security. Overall, there are 1.2 million extra internally displaced people and Kurdish refugees from Syria in KRG since last June. Kurdish leaders claim credit for giving them refuge, but many of those who have lost their homes blame those same leaders for underestimating the Isis threat when it was containable.

The Peshmerga have made successful counter-attacks, taking back much of Sinjar, but Mosul and its surroundings remain firmly under Isis rule and, so long as this continues, the KRG will remain fundamentally insecure. Crucial to the Peshmerga advances have been US air strikes, and it is noticeable in visits to the frontline how dependent the Peshmerga is on US air power.

This staves off the prospect of total defeat, but the future of the Iraqi Kurds still looks grim even if it is not as bad as it looked last August when many in Irbil started to flee the city just as they had done in 1991 during Saddam Hussein’s counter-offensive. Whatever happens, as in Ireland after 2008, the days of the “Kurdish tiger” are truly over.