Over the summer​ Isis – the Islamic State of Iraq and Syria – defeated the Iraqi army, the Syrian army, the Syrian rebels and the Iraqi Kurdish peshmerga; it established a state stretching from Baghdad to Aleppo and from Syria’s northern border to the deserts of Iraq in the south. Ethnic and religious groups of which the world had barely heard – including the Yazidis of Sinjar and the Chaldean Christians of Mosul – became victims of Isis cruelty and sectarian bigotry. In September, Isis turned its attention to the two and a half million Syrian Kurds who had gained de facto autonomy in three cantons just south of the Turkish border. One of these cantons, centred on the town of Kobani, became the target of a determined assault. By 6 October, Isis fighters had fought their way into the centre of the town. Recep Tayyip Erdoğan predicted that its fall was imminent; John Kerry spoke of the ‘tragedy’ of Kobani, but claimed – implausibly – that its capture wouldn’t be of great significance. A well-known Kurdish fighter, Arin Mirkan, blew herself up as the Isis fighters advanced: it looked like a sign of despair and impending defeat.

In attacking Kobani, the Isis leadership wanted to prove that it could still defeat its enemies despite the US airstrikes against it, which began in Iraq on 8 August and were extended to Syria on 23 September. As they poured into Kobani Isis fighters chanted: ‘The Islamic State remains, the Islamic State expands.’ In the past, Isis has chosen – a tactical decision – to abandon battles it didn’t think it was going to win. But the five-week battle for Kobani had gone on too long and been too well publicised for its militants to withdraw without loss of prestige. The appeal of the Islamic State to Sunnis in Syria, Iraq and across the world derives from a sense that its victories are God-given and inevitable, so any failure damages its claim to divine support.

But the inevitable Isis victory at Kobani didn’t happen. On 19 October, in a reversal of previous policy, US aircraft dropped arms, ammunition and medicine to the town’s defenders. Under American pressure, Turkey announced on the same day that it would allow Iraqi Kurdish peshmerga safe passage from northern Iraq to Kobani; Kurdish fighters have now recaptured part of the town. Washington had realised that, given Obama’s rhetoric about his plan ‘to degrade and destroy’ Isis, and with congressional elections only a month away, it couldn’t afford to allow the militants yet another victory. And this particular victory would in all likelihood have been followed by a massacre of surviving Kurds in front of the TV cameras assembled on the Turkish side of the border. When the siege began, US air support for the defenders of Kobani had been desultory; for fear of offending Turkey the US air force had avoided liaising with Kurdish fighters on the ground. By the middle of October the policy had changed, and the Kurds started giving detailed targeting information to the Americans, enabling them to destroy Isis tanks and artillery. Previously, Isis commanders had been skilful in hiding their equipment and dispersing their men. In the air campaign so far, only 632 out of 6600 missions have resulted in actual attacks. But as they sought to storm Kobani, Isis leaders had to concentrate their forces in identifiable positions and became vulnerable. In one 48-hour period there were nearly forty US airstrikes, some only fifty yards from the Kurdish front line.

It wasn’t US air support alone that made the difference. In Kobani, for the first time, Isis was fighting an enemy – the People’s Defence Units (YPG) and its political wing, the Democratic Union Party (PYD) – that in important respects resembled itself. The PYD is the Syrian branch of the Kurdistan Workers’ Party (PKK), which since 1984 has been fighting for self-rule for the 15 million Turkish Kurds. Like Isis, the PKK combines fanatical ideological commitment with military expertise and experience gained in long years of guerrilla war. Marxist-Leninist in its original ideology, the PKK is run from the top and seeks to monopolise power within the Kurdish community, whether in Turkey or Syria. The party’s imprisoned leader, Abdullah Ocalan, the object of a powerful personality cult, issues instructions from his Turkish prison on an island in the Sea of Marmara. The PKK’s military leadership operates from a stronghold in the Qandil Mountain in northern Iraq, one of the great natural fortresses of the world. Most of its fighters, estimated to number seven thousand, withdrew from Turkey under the terms of a ceasefire in 2013, and today move from camp to camp in the deep gorges and valleys of the Qandil. They are highly disciplined and intensely dedicated to the cause of Kurdish nationalism: this has enabled them to wage a war for three decades against the enormous Turkish army, always undeterred despite the devastating losses they have suffered. The PKK, like Isis, emphasises martyrdom: fallen fighters are buried in carefully tended cemeteries full of rose bushes high in the mountains, with elaborate tombstones over the graves. Pictures of Ocalan are everywhere: six or seven years ago, I visited a hamlet in Qandil occupied by the PKK; overlooking it was an enormous picture of Ocalan picked out in coloured stones on the side of a nearby mountain. It’s one of the few guerrilla bases that can be seen from space.

Syria and Iraq are full of armies and militias that don’t fight anybody who can shoot back, but the PKK and its Syrian affiliates, the PYD and YPG, are different. Often criticised by other Kurds as Stalinist and undemocratic, they at least have the capacity to fight for their own communities. The Islamic State’s string of victories against superior forces earlier this year came about because it was fighting soldiers, such as those in the Iraqi army, who are low in morale and poorly supplied with weapons, ammunition and food, thanks to corrupt and incompetent commanders, many of whom are liable to flee. When a few thousand Isis fighters invaded Mosul in June they were in theory facing sixty thousand Iraqi soldiers and police. But the real figure was probably only a third of that: the rest were either just names on paper, with the officers pocketing the salaries; or they did exist but were handing over half their pay to their commanders in return for never going near an army barracks. Not much has improved in the four months since the fall of Mosul on 9 June. According to an Iraqi politician, a recent official inspection of an Iraqi armoured division ‘that was meant to have 120 tanks and 10,000 soldiers, revealed that it had 68 tanks and just 2000 soldiers’. The Iraqi Kurdish peshmerga – literally ‘those who confront death’ – aren’t immensely effective either. They are often regarded as better soldiers than the soldiers in the Iraqi army, but their reputation was won thirty years ago when they were fighting Saddam; they have not done much fighting since, except in the Kurdish civil wars. Even before they were routed by Isis in Sinjar in August, a close observer of the peshmerga referred to them derisively as ‘pêche melba’; they were, he said, ‘only good for mountain ambushes’.

The Islamic State’s success has been helped not just by its enemies’ incompetence but also by the divisions evident between them. John Kerry boasts of having put together a coalition of sixty countries all pledged to oppose Isis, but from the beginning it was clear that many important members weren’t too concerned about the Isis threat. When the bombing of Syria began in September, Obama announced with pride that Saudi Arabia, Jordan, the United Arab Emirates, Qatar, Bahrain and Turkey were all joining the US as military partners against Isis. But, as the Americans knew, these were all Sunni states which had played a central role in fostering the jihadis in Syria and Iraq. This was a political problem for the US, as Joe Biden revealed to the embarrassment of the administration in a talk at Harvard on 2 October. He said that Turkey, Saudi Arabia and the UAE had promoted ‘a proxy Sunni-Shia war’ in Syria and ‘poured hundreds of millions of dollars and tens of thousands of tons of weapons into anyone who would fight against Assad – except that the people who were being supplied were al-Nusra and al-Qaida and the extremist element of jihadis coming from other parts of the world’. He admitted that the moderate Syrian rebels, supposedly central to US policy in Syria, were a negligible military force. Biden later apologised for his words, but what he had said was demonstrably true and reflects what the administration in Washington really believes. Though they expressed outrage at Biden’s frankness, America’s Sunni allies swiftly confirmed the limits of their co-operation. Prince al-Waleed bin Talal al-Saud, a business magnate and member of the Saudi royal family, said: ‘Saudi Arabia will not be involved directly in fighting Isis in Iraq or Syria, because this does not really affect our country explicitly.’ In Turkey, Erdoğan said that so far as he was concerned the PKK was just as bad as Isis.

Excluded from this bizarre coalition were almost all those actually fighting Isis, including Iran, the Syrian army, the Syrian Kurds and the Shia militias in Iraq. This mess has been much to the advantage of the Islamic State, as illustrated by an incident in northern Iraq in early August when Obama sent US special forces to Mount Sinjar to monitor the danger to the thousands of Yazidis trapped there. Ethnically Kurdish but with their own non-Islamic religion, the Yazidis had fled their towns and cities to escape massacre and enslavement by Isis. The US soldiers arrived by helicopter and were efficiently guarded and shown around by uniformed Kurdish militiamen. But soon afterwards the Yazidis – who had been hoping to be rescued or at least helped by the Americans – were horrified to see the US soldiers hurriedly climb back into their helicopter and fly away. The reason for their swift departure, it was revealed later in Washington, was that the officer in charge of the US detachment had spoken to his Kurdish guards and discovered that they weren’t the US-friendly peshmerga of the Kurdistan Regional Government but PKK fighters – still listed as ‘terrorists’ by the US, despite the central role they have played in helping the Yazidis and driving back Isis. It was only when Kobani was on the verge of falling that Washington accepted it had no choice but to co-operate with the PYD: it was, after all, practically the only effective force still fighting Isis on the ground.

And then there was the Turkish problem. US planes attacking Isis forces in Kobani had to fly 1200 miles from their bases in the Gulf because Turkey wouldn’t allow the use of its airbase at Incirlik, just a hundred miles from Kobani. By not preventing reinforcements, weapons and ammunition from reaching Isis in Kobani, Ankara was showing that it would prefer Isis to hold the town: anything was better than the PYD. Turkey’s position had been clear since July 2012, when the Syrian army, under pressure from rebels elsewhere, pulled out of the main Kurdish areas. The Syrian Kurds, long persecuted by Damascus and politically marginal, suddenly won de facto autonomy under increasing PKK authority. Living mostly along the border with Turkey, a strategically important area to Isis, the Kurds unexpectedly became players in the struggle for power in a disintegrating Syria. This was an unwelcome development for the Turks. The dominant political and military organisations of the Syrian Kurds were branches of the PKK and obeyed instructions from Ocalan and the military leadership in Qandil. The PKK insurgents, who had fought for so long for some form of self-rule in Turkey, now ruled a quasi-state in Syria centred on the cities of Qamishli, Kobani and Afrin. Much of the Syrian border region was likely to remain in Kurdish hands, since the Syrian government and its opponents were both too weak to do anything about it. Ankara may not be the master chess player collaborating with Isis to break Kurdish power, as conspiracy theorists believe, but it saw the advantage to itself of allowing Isis to weaken the Syrian Kurds. It was never a very far-sighted policy: if Isis succeeded in taking Kobani, and thus humiliating the US, the Americans’ supposed ally Turkey would be seen as partly responsible, after sealing off the town. In the event, the Turkish change of course was embarrassingly speedy. Within hours of Erdoğan saying that Turkey wouldn’t help the PYD terrorists, permission was being given for Iraqi Kurds to reinforce the PYD fighters at Kobani.

Turkey’s volte face was the latest in a series of miscalculations it had made about developments in Syria since the first uprising against Assad in 2011. Erdoğan’s government could have held the balance of power between Assad and his opponents, but instead convinced itself that Assad – like Gaddafi in Libya – would inevitably be overthrown. When this failed to happen, Ankara gave its support to jihadi groups financed by the Gulf monarchies: these included al-Nusra, al-Qaida’s Syrian affiliate, and Isis. Turkey played much the same role in supporting the jihadis in Syria as Pakistan had done supporting the Taliban in Afghanistan. The estimated 12,000 foreign jihadis fighting in Syria, over which there is so much apprehension in Europe and the US, almost all entered via what became known as ‘the jihadis’ highway’, using Turkish border crossing points while the guards looked the other way. In the second half of 2013, as the US put pressure on Turkey, these routes became harder to access but Isis militants still cross the frontier without too much difficulty. The exact nature of the relationship between the Turkish intelligence services and Isis and al-Nusra remains cloudy but there is strong evidence for a degree of collaboration. When Syrian rebels led by al-Nusra captured the Armenian town of Kassab in Syrian government-held territory early this year, it seemed that the Turks had allowed them to operate from inside Turkish territory. Also mysterious was the case of the 49 members of the Turkish Consulate in Mosul who stayed in the city as it was taken by Isis; they were held hostage in Raqqa, the Islamic State’s Syrian capital, then unexpectedly released after four months in exchange for Isis prisoners held in Turkey.

Had​ Erdoğan chosen to help the Kurds trapped in Kobani rather than sealing them off, he might have strengthened the peace process between his government and the Turkish Kurds. Instead, his actions provoked protests and rioting by Kurds across Turkey; in towns and villages where there had been no Kurdish demonstrations in recent history tyres were burned and 44 people were killed. For the first time in two years, Turkish military aircraft struck at PKK positions in the south-east of the country. It appears that Erdoğan had thrown away one of the main achievements of his years in power: the beginnings of a negotiated end to the Kurdish armed insurgency. Ethnic hostility and abuse between Turks and Kurds have now increased. The police suppressed anti-Isis demonstrations but left pro-Isis demonstrations alone. Some 72 refugees who had fled to Turkey from Kobani were sent back into the town. When five PYD members were arrested by the Turkish army they were described by the military as ‘separatist terrorists’. There were hysterical outbursts from Erdoğan’s supporters: the mayor of Ankara, Melih Gökçek, tweeted that ‘there are people in the east who pass themselves off as Kurdish but are actually atheist Armenians by origin.’ The Turkish media, increasingly subservient to or intimidated by the government, played down the seriousness of the demonstrations. CNN Turk, famous for showing a documentary on penguins at the height of the Gezi Park demonstrations last year, chose to broadcast a documentary on honeybees during the Kurdish protests.

How great a setback would it be for Isis if it failed to capture Kobani? Its reputation for always defeating its enemies would be damaged, but it has shown that it can stand up to US airstrikes even when its forces are concentrated in one place. The caliphate declared by Abu Bakr al-Baghdadi on 29 June is still expanding: its biggest victories, in Anbar Province, have given it another quarter of Iraq. A series of well-planned attacks in September saw Isis capture territory around Fallujah, forty miles west of Baghdad. An Iraqi army camp at Saqlawiyah was besieged for a week and overrun: three hundred Iraqi army soldiers were killed. As in the past, the army proved incapable of staging an effective counteroffensive despite support from US airstrikes. On 2 October, Isis launched a series of attacks which captured Hit, a town north of Ramadi, leaving the government holding only a single army base in the area. Isis forces are today very close to the Sunni enclaves in west Baghdad: until now these have remained quiet, though every other Sunni area in the country has been in turmoil. According to Isis prisoners, the Isis cells in the city are waiting for orders to rise up in co-ordination with an attack from outside the capital. Isis might not be able to seize all of Baghdad, a city of seven million people (the majority Shia), but it could take the Sunni areas and cause panic throughout the capital. In wealthy mixed districts like al-Mansour in west Baghdad half the inhabitants have left for Jordan or the Gulf because they expect an Isis assault. ‘I think Isis will attack Baghdad, if only to take the Sunni enclaves,’ one resident said. ‘If they hold even part of the capital they will add credibility to their claim to have established a state.’ Meanwhile, the government and the local media doggedly play down the seriousness of the threat of an Isis invasion in order to prevent mass flight to safer Shia areas in the south.

The replacement of Nouri al-Maliki’s corrupt and dysfunctional government by Haider al-Abadi hasn’t made as much difference as its foreign backers would like. Because the army is performing no better than before, the main fighting forces facing Isis are the Shia militias. Highly sectarian and often criminalised, they are fighting hard around Baghdad to drive back Isis and cleanse mixed areas of the Sunni population. Sunnis are often picked up at checkpoints, held for ransoms of tens of thousands of dollars and usually murdered even when the money is paid. Amnesty International says that the militias, including the Badr Brigade and Asaib Ahl al Haq, operate with total immunity; it has accused the Shia-dominated government of ‘sanctioning war crimes’. With the Iraqi government and the US paying out big sums of money to businessmen, tribal leaders and anybody else who says they will fight Isis, local warlords are on the rise again: between twenty and thirty new militias have been created since June. This means that Iraqi Sunnis have no choice but to stick with Isis. The only alternative is the return of ferocious Shia militiamen who suspect all Sunnis of supporting the Islamic State. Having barely recovered from the last war, Iraq is being wrecked by a new one. Whatever happens at Kobani, Isis is not going to implode. Foreign intervention will only increase the level of violence and the Sunni-Shia civil war will gather force, with no end in sight.

24 October