A shepherd who fled Mosul when it was overrun by Isis forces, pictured in the Taq Taq oil field in Iraqi Kurdistan

Machko is a traditional Kurdish tea room at the foot of the centuries-old Erbil citadel, a casual gathering place for artists and politicians. Surrounded by walls of faded pictures showing men in the baggy trousers of traditional costume, and glossier portraits of others wearing dark suits and trendy sunglasses, Mustafa Machko takes payments from customers and tells me about his life. At 27, he has a trading business but looks after the tea room on the side to preserve his grandfather’s legacy. Unlike his parents, Mustafa doesn’t speak Arabic, has never visited Baghdad and says he has no attachment to an entity called Iraq. The only Iraqi aspect of his existence is his passport, which he would gladly give up if he could because it brings him nothing but grief at airports. “When I say I’m from the north of Iraq, people smile at me. When I just say I am Iraqi, I get dirty looks.”

Mustafa Machko represents the new generation of Iraqi Kurds who have lived in the shadow of Iraq but not as part of it. Even though they learn Arabic as a second language at school, they rarely speak it and have no interest in it. When they can afford to, the young people travel to Istanbul, Dubai and Beirut but don’t set foot in the Iraqi capital. Around them in what they refer to as Kurdistan, cities are rising where the Kurdish flag flutters and the road signs, the street and store names and the media are in Kurdish, the official government language. It could take visitors to Erbil, the Kurdish capital, several days to realise they are in Iraq; I notice the word Iraq as an almost accidental addition to the signpost on the Kurdistan parliament building.

Even the landscape in the north is distinct, with rolling hills and spectacular mountains that contrast sharply with the flat deserts of the southwest. When palm trees were planted in the middle of a main avenue in Erbil, the locals protested at what they considered to be a symbol of Iraq. Signs of economic prosperity also set the Kurdish region apart, its shiny five-star hotels and gated communities – with names such as English Village and Italian Village – more reminiscent of an emerging city in the Gulf than of the grim, rundown infrastructure further south. After the US invaded Iraq and deposed Saddam Hussein in 2003, Iraq’s five million Kurds turned the page on decades of oppression and energetically set about an experiment in nation-building, fuelled by wells gushing with oil. They benefited from an Iraqi constitution that gave their region a special, semi-autonomous status. Kurdistan’s progress cemented a long-simmering attachment to independence. The new-generation Kurds are already independent in their hearts and in their minds.

For a moment earlier this summer, people like Machko felt tantalisingly close to achieving the Kurdish dream, a result of the catastrophe that befell Iraq. As the murderous army of jihadis calling themselves the Islamic State of Iraq and the Levant (Isis) advanced on Mosul – the second largest Iraqi city, an hour-and-a-half’s drive from Erbil – a decade-old exercise in Iraqi nation-building, in which the Shia Arab majority shared power with the Sunni Arabs and the Kurdish minority, shattered. The Kurdish president, Masoud Barzani, who had spent the previous few years squabbling with the central government in Baghdad, declared he was no longer bound by the Iraqi constitution and called on the Kurdish parliament to prepare for an independence referendum. “The time has come to determine our fate and we should not wait for other people to determine it for us.”

Barzani’s government had been quietly working towards that moment for at least two years, as his patience with the authoritarianism of ex-Iraqi prime minister Nouri al-Maliki ran out. According to a senior aide, the Kurdish leader had written to Barack Obama months before the fall of Mosul, analysing Iraq’s predicament and telling him that Kurds would hold a referendum on independence. The official says the last straw for Barzani was the fall of Mosul; Maliki had refused to heed his repeated warnings about jihadi intentions towards the city.

Secession, of course, is a messy business in the most stable parts of the world, so what of a would-be nation cursed by geography? Landlocked and part of a violent, troubled state, Kurdistan is also surrounded by countries hostile to its ambitions. Indeed, Kurdish independence could shake the Middle East like an earthquake, rocking the foundation of nearby states with Kurdish minorities – Syria, Turkey and Iran – and marking the first redrawing of the Middle East map since the 1916 Sykes-Picot agreement sliced up Ottoman Empire possessions into nation states. Not surprisingly, the message sent to the Kurds by Iran and Turkey but also, quite firmly, by the US, was this: no one was ready for a Kurdish republic. The priority was to defeat Isis and, for that, the territorial integrity of Iraq had to be preserved.

. . .

The Kurds quickly discovered that they too might have been precipitous in their bid for freedom. By August, the Isis blitzkrieg had reached closer to Erbil, sending waves of terrified residents fleeing for safety. The Kurdish army, the peshmerga – mountain warriors celebrated for staging repeated rebellions, whose name signifies “those who confront death” – were close to collapse. “We realised we are now neighbours with a terrorist organisation that shares a 1,000km border with us and we no longer share but 15km with the government of Baghdad. It was a big threat,” says Masrour Barzani, son of the president and Kurdistan’s head of national security. “We decided to fight back and we started to fight back but we were outgunned, with [our] obsolete equipment.”

The peshmerga, like other public employees, had not been paid their salaries in months. The Kurdistan Regional Government was virtually broke, the share of revenues from Baghdad withheld by the Maliki government since the start of the year over an oil dispute. Across Erbil, cranes stood idle, skeleton buildings unfinished, contractors’ bills unpaid and businessmen distressed. The government was funding itself by borrowing from private companies. The Kurds called for help and the Americans responded with air strikes, the Iranians with military advisers and artillery, and the Turks with loans. “Independence is a strategic project but we were not ready, the infrastructure wasn’t ready, the economy wasn’t ready and our defences were not ready,” says Rewas Fayak, a parliamentarian in Erbil.

In the past two months, the discourse about independence has been toned down but the frustration is palpable. “It’s not a dream, it’s an objective,” Masrour Barzani shoots back at me when I ask about “dreams” of independence. “Why are the Kurds deprived of their rights? Because everybody is looking for their own interests.” The Kurds have now joined the new government in Baghdad that the US helped engineer, and leaders say they are willing to give Iraq one last chance. “We can’t be the reason – we won’t be the reason – that Iraq fails,” says Qubad Talabani, the deputy prime minister. But it is difficult to find anyone in Kurdistan who believes that Iraq will be saved. The answer could be a confederation, according to Nechirvan Barzani, the prime minister and nephew of the president, who I meet in his grand office in a building that bears a curious resemblance to the White House. Casual and good-humoured despite Kurdistan’s troubles, he says Iraqis have proved they have no loyalty to the state. “Shia are not ready to be killed in [mostly Sunni] Mosul, those in Mosul are not ready to be killed in [the Shia cities of] Najaf and Karbala, Kurds are not ready to be killed in Mosul. We have to find a formula for how to live together, that’s what is most important, and find out how we endure each other within a geography called Iraq.”

. . .

By the time I arrived in Erbil earlier this month, Isis had been pushed back by American air strikes and newly armed peshmerga ground advances. The panic that had gripped the city only a few weeks earlier had dissipated. But the Kurds were still not feeling secure. In the Qaisari market near the citadel, where young men sell everything from the latest mobile phone models to clothes and shoes, Daesh – as Isis is known in the region – dominates the chatter. The only upbeat merchant I meet is Rebwar Othman: he sells peshmerga uniforms and mostly fake military equipment, and a few real rifles as well. “Because of Daesh my business is good. Everyone needs binoculars to see where Daesh is.”

We have to find a formula for how to live together, that’s what is most important, and find out how we endure each other within a geography called Iraq

I find the peshmerga invigorated by the confrontation with Isis when I visit them on the frontline in the plains on the outskirts of Erbil, where they have dug deep trenches and established their defensive line. The fighters say they hadn’t thought about their pay until I raised the question – they are too consumed by the defence of Kurdistan. Those I meet are the professional soldiers but every Kurdish man, and quite a few women, has been a peshmerga at some point. “Peshmerga is a symbol of freedom; my father was a peshmerga, my son is a peshmerga,” says Brigadier Didewan Khoorshid. “We’re proud of what we’ve done in the last two months,” he adds, showing me a picture of himself with a smiling President Barzani during a recent visit to Khoorshid’s base. (Even the president has reverted to being a peshmerga and spends much of his time on the front.) Khoorshid says the recapture of Mosul is essential for Kurdistan’s security but predicts it will take at least a year to drive out Isis. “As long as you are near a fire you will be burnt.”

The brigadier’s men take me to one of the villages recaptured from Isis in September, an abandoned hamlet of concrete houses in ruins, some blown up from inside, others demolished by air strikes. We climb up to the roof of a house transformed into a peshmerga headquarters, and the officer in charge, Said Hajar, points to a cluster of blocks some 2km away. “Daesh is there,” he says. “And it’s a strong enemy. They’ve tried twice to retake the village we’re in, and they don’t just fight with tanks, they fight with booby traps and explosives.”

. . .

The peshmerga occupy a mythical place in Kurdish culture, even if they proved to be less formidable than their image in the war against Isis. The name was first given to the army of Mullah Mustafa Barzani – the current president’s father and hero of Kurdish nationalism – during the Mahabad republic, a shortlived Kurdish independence experiment in Iran in 1946. It was in the city of Mahabad that Masoud Barzani was born; reclaiming his father’s legacy has been his life-long ambition.

On a bright autumn day, I visit Barham Salih, the former Kurdish prime minister who I’ve known for many years, at his home in Erbil. He tells me that what binds Kurds is not only a culture that celebrates the love of life and the beauty of the mountains but also the repression that has blighted them throughout history – and their resistance to it. “Kurdistan is persecution but also determination to overcome it.”

The Kurds refer to themselves as the world’s largest stateless nation, a community of 30 million people, mostly from the Sunni sect of Islam, who are scattered across several states. They have suffered almost continuous subjugation, their ambitions for self-determination also weighed down by tribal divisions and political miscalculations. Kurdish nationalism dates back to the early 20th century as the Ottoman Empire was collapsing; two attempts at setting up a Kurdish republic were suppressed by Turkey and Iran. Romantically, says Barham Salih, every Kurd wants a united Kurdistan, not only a state carved out of Iraq. “But we know that’s not possible – it’s like Arab nationalism – so the emphasis is to focus on Iraqi Kurdistan, where we have a nation in the making, a work in progress.”

Peshmerga is a symbol of freedom; my father was a peshmerga, my son is a peshmerga. We’re proud of what we’ve done in the last two months [against Isis]

No event in recent Kurdish memory symbolises the plight of the community more than Saddam Hussein’s 1980s Anfal campaign, which destroyed thousands of Kurdish villages, killed more than 182,000 civilians and ravaged the mountains, the trees and the livestock. Bakir Abdulkader Abdullah was a peshmerga in Halabja, the city near the Iranian border where, in 1988, Saddam gassed the Kurds as punishment for capturing the city and fighting alongside Tehran during the Iran-Iraq war. A composed, serious man dressed in a tailored pinstriped Kurdish costume, he talks to me at his home in a middle-class neighbourhood of Erbil. Asked to relate the events of March 16 he suddenly breaks down, his head dropping into his hands. Four aeroplanes had bombed at first, then dropped papers to check the wind direction, before the gas was unleashed, he tells me after a long silence, recalling the yellow and white smoke, the smell of rotten apples and garlic, and the bodies littering the streets. “Halabja became a symbol of our nation and it has encouraged nationalism among all Kurds.”

Halabja is also a reminder of how the world let down the Kurds: the US, like Saddam Hussein, blamed Iran for the attacks because it was politically convenient. Three years later, after Saddam was pushed out of Kuwait by a US-led coalition, the Kurds were encouraged by western powers to rise up against his vulnerable regime. Once again, they were left on their own to face Saddam’s counter-offensive. It was only when 1.5 million Kurds fled towards Iran, and a massive humani­tarian crisis loomed, that the US and its allies established a no-fly zone over northern Iraq, the first international protection accorded to the Kurds. But instead of seizing the historic moment, the Kurds turned their guns against each other.

. . .

On the road out of Erbil towards Suleimania, snaking through the valley of the Safeen mountains, there is a checkpoint manned by forces belonging to Asaish, the intelligence service of the Patriotic Union of Kurdistan (PUK). This is one of the two parties that have dominated Kurdish politics, the other being Barzani’s Kurdistan Democratic Party (KDP). A few meters away from the checkpoint flies a PUK flag. From there and all the way to Suleimania, the PUK stronghold, the only visible portrait is that of Jalal Talabani, the revered PUK leader who has been incapacitated by a stroke for nearly two years.

The checkpoint was the frontline in the PUK-KDP civil war of 1994-1996, in which peshmerga fought each other for control of northern Iraq. Kurdish leaders dragged in neighbours, with Iran sometimes playing one side against the other, and Barzani at one point enlisting Saddam Hussein’s help to defeat the PUK. It was a humiliating episode in the contemporary history of Iraqi Kurds that many prefer not to speak of today. Instead, officials on both sides point to the way the rivalry between the two parties plays out through elections and democratic institutions.

Power has been neatly divided: Barzani has been president of the Kurdistan region since 2005 while Talabani, until recently, was the more national Iraqi figure, taking up the largely ceremonial role of the country’s president. Barzani’s son is head of intelligence, his nephew prime minister, and Talabani’s son, Qubad, is deputy prime minister. True, the dominance of the two parties has also been diluted by the emergence of smaller groups, particularly Gorran, the change movement that split from the PUK. But with 1.4 million out of a 5 million population either receiving salaries or pensions from the government, and the parties still taking the lion’s share of government positions, the patronage system is powerful. “We think the two families are still practically in control of all important arms in society – economic, academic and judicial, and it’s still a complete patronage system,” says Rabun Maaruf, who heads the Gorran bloc in the Kurdish parliament. “But we believe that a majority of Kurds want a new type of party based on meritocracy, not family.”

We realised we are now neighbours with a terrorist organisation [Isis] that shares a 1,000km border with us. We decided to fight back

One businessman reckons that as much as 60 per cent of the business sector is controlled by the two parties or members of the Barzani and Talabani clans. “If you compare Kurdistan to surrounding countries, it is clearly much better than Iraq, Syria or Iran. But we have our own problems,” says Asos Hardi, editor of Awane Press, an independent newspaper in Suleimania. “The political mentality of parties has produced a system in which there are two different areas, one under KDP, one under PUK control – you see it everyday. Security forces are loyal to parties, not the government.” Indeed, there are still two peshmerga forces, one KDP, one PUK. A ministry designed to integrate the peshmerga has been hard at work and is run by a Gorran official. So far, though, only 30,000 out of 150,000 peshmerga are in integrated brigades.

. . .

Before Isis struck Iraq and the vulnerabilities of Kurdistan rose to the surface, it was common to hear comparisons between the region and Dubai. Real estate prices were rocketing and hotels were buzzing with foreigners scouting for business. Unlike diversified Dubai, however, the boom in Kurdistan has been fuelled by a single commodity – oil – and on that the Kurds have pinned hopes for statehood. Silver-haired Ashti Hawrami has been the Kurdistan Regional Government’s minister for natural resources since 2006. We meet in a pink-carpeted guesthouse within the sprawling presidential compound in Salahuddin, the hilltop stronghold of the Barzanis near Erbil. I am at first surprised by his mild manner, given his combative reputation in Baghdad.

Oil has been the main point of contention between the federal government and the Kurdish authorities, which have taken advantage of ­ambiguity in the 2005 Iraqi constitution to exploit their own resources. The dispute reached boiling point earlier this year when the Kurds completed a pipeline to Turkey that allows them to bypass the federal government and export their oil. Baghdad, which says only the central government has the constitutional right to produce and market oil, lashed out earlier this year with a vengeance: it cut Kurdistan’s share of the federal budget, starving it of cash. Payments are only now resuming.

Hawrami suggests to me that the Kurds are so far along in their plans that they now have the upper hand in negotiations with Baghdad and want a deal with the new government that would recognise their economic independence. “Even in a transitional state, when we are still not self-sufficient, we are more viable as a state than 25 to 50 per cent of the world’s nations,” he tells me. By the first quarter of next year, Hawrami estimates, Kurdistan will be selling 500,000 barrels per day of oil, which would provide revenues that are equivalent to the share that it receives by law from the federal budget.

“In 2006 when I took this job I had three fundamental goals: self-sufficiency in power generation, self-sufficiency in internal fuel consumption and the long-term goal was to find economic viability for the region by being self-sufficient financially. That could only be achieved through natural resources. That was our road map,” he says. The first two objectives are close to being realised and the third is far along too, Hawrami adds, with $20bn so far invested in the oil sector and major companies lured to Kurdistan despite Baghdad’s protests.

It is common to hear murmurs in Kurdistan that more diplomacy than confrontation with Baghdad might have been a more useful policy. Among businessmen and critics of the government there are also questions about Kurdistan’s growing reliance on Turkey as an economic anchor. Turkey has been Kurdistan’s unlikely best friend, shifting dramatically from opposition to its autonomy lest it stimulates similar desires among its own Kurdish minority, to a strategic partnership in which Kurdistan is coveted as a source of energy. “He [Hawrami] has been taking us in the direction of Turkey for years but the Turks have a problem even mentioning the world Kurdistan. At least with Iraq we have a constitution that makes us equal partners,” laments Hiwa Osman, a Kurdish commentator. The minister shrugs off the criticism: “With Turkey it’s an alignment of interests and it has developed into a broader geopolitical issue. It is an economic win-win situation.”

. . .

When Isis captured Mosul in June and the Iraqi army melted away, Masoud Barzani rapidly dispatched his peshmerga to Kirkuk to protect its oilfields. Some saw it as a necessary move to thwart an Isis takeover; others worried that it was the perfect land grab. The city, which Kurds refer to as their Jerusalem, is part of the disputed territories the Kurds claim as their own but which are not today within the boundaries of their semi-autonomous region. The status of the territories was to be decided by a referendum that has never taken place and the situation could become explosive if Kurds were to secede from Iraq. When I ask the president’s son, Masrour, whether the peshmerga would eventually cede control to a reconstituted Iraqi army, he says emphatically: “We will not leave Kirkuk.”

We used to say the Kurds have no friend but the mountain, now we say the Kurds have many friends, including the mountain. I don’t know where we are going but I know we will never go back

It’s an easy drive to Kirkuk these days. I am without an Iraqi visa (Kurdistan doesn’t require one) but I pass unhindered through the main crossing, controlled by Iraqi army soldiers who are Kurdish. Barely half an hour from Erbil, it is clear to me that I am in Iraq, the two-lane highway signs in Arabic indicating Baghdad and other cities, the roads more neglected, the sewage overflowing, and the neighbourhoods dreary and densely populated. Even public holidays do not coincide: I left a quiet Erbil commemorating a Shia holiday that is being marked the next day in Kirkuk.

Kirkuk has always been a mosaic of different ethnic cultures – Arab, Kurd, Assyrian and Turkmen – but its demography has been manipulated. Saddam Hussein expelled more than 100,000 Kurds from Kirkuk and settled Arabs in their place, a process of Arabisation that has been reversed since the collapse of the Ba’athist regime in 2003. The city’s governor is a Kurd who belongs to the PUK, a neuro­surgeon who practised in the US and was elected in 2011. Najmeddin Karim still has the reserve of a doctor. He tells me that when the Iraqi army fled, he asked for peshmerga reinforcements. “Kirkuk is Kurdistan and always has been,” he says, and that will be confirmed in an eventual referendum. But Kirkuk also requires a special status, he insists, a power-sharing arrangement that suits all its communities, not only the current Kurdish majority.

I ask him what he thinks the reaction would be from Arabs in Iraq if Kurds incorporated Kirkuk into Kurdistan. “Whatever we do we have to do it without war. If we go to war, we all end up losing,” he says. “We have to do everything we can to bypass this stage and sit together with each other. Even if we break up we should do it amicably.”

. . .

I ask every person I meet whether Kurdistan will still be part of Iraq in a year, and the consensus view is that it will. When I put the timeframe at five years, however, most Kurds tell me that breaking away is far more probable. To fulfil their aspirations for statehood, though, the Kurds are mindful that they need international support and, above all, that they must not risk the progress already achieved. Fuad Hussein, the president’s right-hand man, says: “In our political history we’ve never had such a good time as it is now. We used to say the Kurds have no friend but the mountain, now we say the Kurds have many friends, including the mountain. I don’t know where we are going but I know we will never go back to the stage where we lose what we have and the world doesn’t care about us.”

Perhaps the biggest dilemma the Kurds face is that an independent Kurdistan could become a reality if Iraq disintegrates – and yet for a peaceful divorce they need a functioning Iraq. “A good option for us is a federal, democratic Iraq and for that we could be part of the solution. But even if we are an independent Kurdistan, a decent Iraq is vital for us,” says Barham Salih, the former prime minister. “Kurdish independence won’t come only through good relations with Turkey or Iran. The anchor has to be Baghdad.”

Roula Khalaf is the FT’s foreign editor

Photographs: Sebastian Meyer