The self-styled caliphate has been in rapid decline since Turkey joined the war in northern Syria. But if the jihadis refocus their efforts on acts of terrorism in the west, victory may be short lived

It has been a bad few months for Islamic State (Isis). For the first time since the terror group laid claim to much of Iraq and Syria, it no longer has a direct path to Europe. Black flags are no longer flying over towns and villages near the Turkish border and the militants of the so-called caliphate are on the run. If the decay continues, Isis will soon lose much of its remaining foothold in Syria. Its last bastion will be Raqqa and the north-eastern deserts, where it all began for the group’s latest incarnation in April 2013, and from where much of its subsequent rampage was plotted.

Since mid-July, Isis has been methodically pushed from towns and villages it controlled near the Turkish frontier by the most concerted ground advance of the past two years. The jihadist group now looks to be far less of a threat to the regional order than when its leader, Abu Bakr al-Baghdadi, proclaimed his rule over a swath of eastern Syria and western Iraq in mid-2014.

But little about what comes next is clear. The group’s loss of territory has shifted geopolitical ground in ways that could not easily have been predicted. And, in the eyes of many European governments, its danger has metastasised into a global threat that a loss of land won’t mitigate. A military victory over one of modern history’s most savage band of marauders may yet prove pyrrhic.

Facebook Twitter Pinterest Isis fighters parade through Raqqa after its capture in June 2014. Photograph: Reuters

Isis once controlled a stretch from the town of al-Bab in the Aleppo hinterland to Mosul in northern Iraq. It regularly moved men between the two points, using Turkey, not far north, as a supply line for fighters, money and food. From this arc of influence, it created a bulwark against threats from the outside, and a self-sustaining society built on oil revenues, taxes and loot seized from vanquished Iraqi and Syrian forces.

Within months of seizing Iraq’s second biggest city, Mosul, in June 2014, Isis had splintered the authority of embattled leaders on both sides of the now-irrelevant border between Iraq and Syria and created a terrifying new form of governance, rooted in an uncompromising reading of Islamic tenets and unchecked savagery. Isis leaders lorded over their gateways such as Manbij and Jarabulus, along the Turkish frontier. Foreign fighters, including some who have since returned to Europe, used the towns as waypoints when they entered the “caliphate” and when they travelled back to Turkey.

Facebook Twitter Pinterest Turkish tanks and armoured vehicles on the road to Jarabulus in August. Photograph: Reuters

Isis lost both in recent weeks. After a month-long push, Manbij fell to Kurdish groups whom the US had raised as a proxy infantry. Jarabulus, however, was taken in less than 24 hours by the Turkish military, which had made its first full-scale incursion into Syria since the start of the uprising against Bashar al-Assad five years ago. But even more important than Ankara’s stated goal of stopping Isis is preventing the US-backed Kurds from advancing into areas that would secure them their historical ambitions to control territory held by Arabs in north-eastern Syria.

By crossing the border, Turkey has changed the face of the war against Isis. A bit player for much of the campaign, it now has a lead stake on how the rest of the military offensive is fought and, more essentially, who does the fighting.

Arab rebel groups made up of reconfigured units of the anti-Assad Free Syria Army rode in on Turkish tanks to take 680 sq km (420 sq m) of Syria, and are now aiming to consolidate a buffer zone 60km south of the border. Al-Bab, where Isis extremists planned much of the carnage they have wreaked in Paris, Brussels and Istanbul, is now squarely in the invaders’ sights. The US-backed Kurds, meanwhile, have stopped advancing, their ranks thinned by the defection of dozens of Arab fighters who had reluctantly allied with them.

How Isis has lost territory in Syria over the past year How Isis has lost territory in Syria over the past year

The march of the new alliance through Jarabulus has laid bare more of the workings of Isis, a group that has been exposed by a string of defeats, and an estimated 35,000-50,000 battle deaths. “They created institutions to brainwash the minds of the children, and they have been widely successful,” says Mohammed Hamdan, a local councillor from Jarabulus. “All the elements of economic life are gone. They forced people to work with them.”

In Manbij, as soon as the jihadists fled, local women stripped off full-face coverings and black gowns that had been mandatory under Isis. Schools that had been shuttered were soon being swept out and reopened. People started to smoke again. Men cut off their beards. To do so while the jihadists were there would have led to a flogging – or worse. In Jarabulus, the ubiquitous black banner that had been painted over government buildings was whitewashed. Markets opened and people again mingled.

“Isis used Jarabulus as a starting point for its operations in Turkey,” says Hamdan. “They used the mosques to advocate brutal killings, which became the dominant theme in recent months. They used mosques to tell people that they were still under control.

Facebook Twitter Pinterest A man celebrates his liberation from the hands of Isis in Manbij by having his beard cut off, August 2016. Photograph: Rodi Said/Reuters

“But tension and worry was obvious. It spread after Isis realised it was going to lose a significant part of strategic territory. Most of the people, whether pro-Isis or not, withdrew from the city towards Maskanah and al-Tabqa and then to Raqqa.”

These areas amount to the last redoubt of Isis in Syria and will be the targets of a push later this year. Who gets to do the fighting is, as yet, unclear. The link to the Iraqi strongholds of al-Bukamal, Ba’ej, Tal Afar and Mosul remains viable for now, but in Iraq, as in Syria, the self-styled caliphate is rapidly contracting.

In Iraq, an assault on Mosul, which has previously been deemed too difficult, is now being seen as a reality for early next year. Iraqi forces that fled as the jihadists advanced have been reconfigured and galvanised. “Confidence has emerged from battlefield gains,” says a Baghdad-based US diplomat. “And while the Iraqis are feeling better about themselves, Isis is feeling worse. Everywhere they have tried to make a stand in recent times, they have been hosed out. They know it’s near the end.”

Facebook Twitter Pinterest Members of the Free Syrian Army stand in front of an Isis mural in Jarabulus. Photograph: Cem Özdel/Anadolu Agency/Getty Images

For all its blind dogma, the Isis leadership has shown a pragmatism. Control of territory, so vital in the heady early days, is no longer as important to Baghdadi and his senior leaders as controlling populations beyond the caliphate’s fast-shrinking boundaries. “They have highly intelligent leaders calling the shots, being prepared to sacrifice thousands of lessers who are far less disciplined about how they get around and communicate,” says one western diplomat.

Another Isis observer, a security official, says: “It’s very clear that they have sent people to Europe. We know that they expect some to be caught and they accept that. They have others on the way, or already in place.”

The Paris and Brussels plotters returned to Europe after being trained between al-Bab and Raqqa by an Isis cell that had been tasked with causing chaos in the west. Both cells were sent across the border into Turkey and then on a painstaking journey through the continent, tailored to avoid detection.

Another Isis figure, a petty criminal from the south-west London suburb of Hammersmith, was also sent on his way to Europe around the same time. His name was Aine Lesley Davis, and he was one of a trio of British nationals who brutalised western hostages in Syria in 2013 and 2014. The group was dubbed “the Beatles”. Their leader, Mohammed Emwazi, was the black-clad executioner who beheaded seven hostages on camera in some of the most horrific images of the extremists’ era. Alexander Kotey, another west London convert, was the third member of the sadistic trio, intelligence officials believe.

Facebook Twitter Pinterest Mohammed Emwazi, AKA Jihadi John. Photograph: Rex/Shutterstock

Davis, 32, got as far as Istanbul before being caught on 7 November 2015 by Turkish intelligence officers, who had been alerted by neighbours to a group of Arab men who had moved into the area. This week, a Turkish prosecutor released an indictment on Davis, which accused him of crossing the border near Jarabulus and linking with two senior Turkish members of Isis. “To cross into Turkey, he communicated with İlhami Balı (code name Abu Baker) and Necip Süleyman (Abu Sham Al Ansari), Isis Turkey border ‘emirs’,” the indictment read. “Balı’s name is linked to the Ankara attack in October 2015, which killed more than 100 people.”

Emwazi was killed by a CIA drone strike in Raqqa five days after Davis was arrested in Istanbul. Kotey’s whereabouts remain unknown. And while security officials in Europe believe that much of Isis’s original foreign fighter corps has been killed – they were seen as dispensable by their leaders – several hundred have returned to Europe, where they are awaiting instructions from inside Syria and Iraq.

“That, in a sense, is the reason why it doesn’t really matter if they lose this land right now,” says the western diplomat. “They are an even more potent threat than they were a year ago.”

Facebook Twitter Pinterest Could the west be a renewed target after a refocus on terrorist atrocities by Isis? Photograph: Malte Christians/EPA

The calculation by Isis leaders is that acolytes, fired by some sense of divine purpose, will launch their own attacks, without direct instruction or organisation. Such strikes are increasingly valuable, and damaging to the caliphate’s foes. They are relatively easy to commit, and very difficult to detect.

Though fast losing ground, and with morale low in many of their embattled communities, Isis leaders continue to believe that the organisation which first rose out of the US invasion of Iraq in 2003 derives considerable potency from Sunni Muslim resentment. The Isis narrative is that Sunnis, the majority Islamic sect, have been stripped of power and influence by western powers who have handed the reins to the minority Shias. They anchor their very contemporary political gripes in an ancient creed, which says that much of this was preordained.

An essential sell for Isis leaders to would-be jihadists such as Davis, Kotey and Emwazi is that their generation has the privilege to not only correct recent indignities, but to restore the lost glories of Islam. The withering caliphate is becoming the latest casus belli – a divine mission to replace the “falsehood” of the nation state with Islamic rule being stripped away by yet more western aggression.

Facebook Twitter Pinterest Turkish workers with some of the modular blocks that will form the wall along the Syrian border. Photograph: AP

How that aggression takes shape in the coming months will be pivotal to the direction of the war against the jihadists – and the overall course of the Syrian war. The campaign against Isis had been fought mostly as a subset of the broader war, but has been increasingly drawn into the main conflict.

For now, Turkey’s role will continue to be instrumental, its aim – to keep two Kurdish cantons separated by a 140km (90-mile) gap, in which Arab groups call the shots – now within reach. Accused of being too slow to react to the threat from Isis, whose ranks were reinforced largely through the then-porous Turkish border, Ankara is now building a wall along much of it.

In Iraq, Isis now has just as much trouble securing supply lines outside its strongholds. The border with Syria remains a free-for-all, but offers little to increasingly desperate fighters seeking refuge or escape. The desert frontiers of Saudi Arabia and Jordan are better policed and even more foreboding.

“Morale is desperate,” one Isis official tells the Guardian. “Even in Raqqa. But they are very smart. They have made plans for all of this. They are investing a lot in sending their people to Europe, and it won’t be over soon. You’ve seen them throughout their history. Whenever they are being beaten, they lay low. They will come back later. They still have their ideology.”

Additional reporting by Şafak Timur.