Jonathon Gatehouse and Adnan R. Khan wrote this story in the days following the terror attack on Paris in November 2015. After the July 15, 2016 attack on Nice, Khan wrote about the impossible task of stopping terrorism.

Islamic State chose to run, rather than fight. Hours before a small group of extremists launched a series of attacks in Paris in its name—killing 129 and deeply scaring one of the world’s great cities—a lopsided battle was unfolding inside Syria. Sinjar, a key city on the road connecting ISIS’s de facto capital Raqqa, and Mosul, its prize possession in Iraq, was being recaptured by Kurdish and Yazidi forces, cutting off a major supply corridor for the terror group. Prior to the Nov. 12 assault, its positions had been pounded for days with airstrikes from coalition jets. By the time Kurdish troops entered the city, few defenders remained. “We didn’t fire a shot when we advanced. There can’t have been more than 20 Daesh,” a peshmerga fighter, referring to ISIS by its Arabic acronym, told the Abu Dhabi-based newspaper, The National.

They left behind mines and booby traps, and staged one token counterattack on the highway outside town. Making use of their most plentiful resource—fanatical believers—the extremists bolted a steel plate to an old truck, loaded it with explosives and sent the driver on a kamikaze mission toward the peshmerga positions. The Kurds were ready, if not fully prepared, having started construction of an earth berm across the road. A video of the incident, first posted by the New York Times, shows tracers bouncing off the tarmac as they opened fire on the approaching vehicle. The first anti-tank missile missed the mark, exploding behind the truck. A second one did not. The ISIS driver was the only casualty.

Islamic State’s own tactics may have been at the heart of its defeat. After capturing Sinjar in August 2014, its forces murdered hundreds—perhaps thousands—of young boys and old men, shooting them in the head, or pushing them off cliffs. Many young Yazidi women were raped, or sold into slavery. Tens of thousands of civilians fled. It meant Western air forces had few concerns about innocents being caught up in the bombing. “It was a little weird walking into the middle of the city. It was completely empty,” Zana, a Kurdish journalist who covered the battle, told Maclean’s. “But I thought ISIS would give more of a fight.”

Sinjar was only the latest in a series of embarrassing losses that have put Islamic State on its heels in Iraq and Syria. At the end of January this year, the group suffered its first major defeat, losing a protracted battle against Syrian Kurds in Kobani. Over the months that followed, the peshmerga have methodically pushed ISIS out of more and more territory, cutting off much of its access to the outside world along Syria’s border with Turkey. In recent weeks, the tempo of coalition airstrikes has picked up noticeably, as the U.S. and its allies press the advantage. The “caliphate” declared by the ISIS leader, Abu Bakr al-Baghdadi, last year, has been reduced to isolated outposts, and ISIS’s estimated 60,000 fighters suddenly seem stretched and overmatched.

It would all be welcome news, except for the darker reality of Paris, Beirut and Egypt. As the Islamic State comes under ever-increasing pressure in Syria and Iraq, it has developed a new capacity to inspire and influence mass acts of terror abroad. Attracting followers and gaining allies at an alarming pace, the group is now supplanting al-Qaeda as the world’s most dangerous jihadist ideology. Since the beginning of 2015, the terror organization has steadily increased its international activities, with attacks attributed to its affiliates in Libya, Egypt, Yemen and Bangladesh. And its latest grim successes—224 dead in the Sinai, 43 bodies in the Beirut neighbourhood of Burj al-Barajneh, 129 dead and more than 300 wounded in the French capital—are surely not the last. The West’s war on terror has entered a new phase, but there is still no end in sight.

Islamic State was always mostly a state of mind. Ayman al-Zawahiri, the leader of al-Qaeda—ISIS’s fading rival—has often argued that the Muslim world isn’t ready for an actual caliphate. The original vision of Osama bin Laden called instead for a long-haul holy war, one that focused on converting the world’s Muslims to the cause before attempting to set up an overarching and all-controlling Islamic government.

Times changed, however, from the early days of the Iraq war, when ISIS was merely a junior jihad partner, and went by the name al-Qaeda in Iraq. The group’s Jordanian founder, Abu Musab al-Zarqawi, was a feared player in the insurgency, and his fighters were renowned for their brutality. But after his death in 2006, it seemed like his all-out brand of terror—including the torture and beheading of opponents—had fallen out of vogue.

It wasn’t until 2010, when Abu Bakr al-Baghdadi took over, that the organization that became Islamic State really began to take shape, following a simple and brutal logic: spark a sectarian war against Iraq’s Shia majority and wait for the blowback to marginalize Sunnis and push them into the fold. As it turned out, the strategy of driving wedges between ethnic and sectarian communities worked even better than expected, helped along by massive failures in U.S. policy as well as political meddling from Iraq’s Shia neighbour, Iran. In late 2012, the group expanded its operations into Syria, under the banner of the al-Nusra Front.

The final rupture with al-Qaeda came in the spring of 2013 when Baghdadi merged his forces in Syria and Iraq and announced the creation of the Islamic State of Iraq and the Levant. Within months, his group, led by seasoned fighters from Iraq, including former officers from Saddam Hussein’s army, capitalized on the madness and confusion of the Syrian civil war and swept over large swaths of territory in both countries, electrifying the global jihadi community with their spectacular success. By the end of June 2014, Baghdadi declared his caliphate and had fighters from all over the world flocking to the cause.

Western leaders have been decrying Islamic State’s atrocities, and promising to halt its advances, for well over a year now. But for all the solemn pledges and bravado, the West has so far shown limited success.

One major difficulty is that ISIS remains the world’s best-funded terrorist group, drawing on diversified revenue streams that bring in millions each day. “It has amassed wealth at an unprecedented pace,” David Cohen, the U.S. Treasury Department’s undersecretary for terrorism and financial intelligence admitted in a speech to a Washington think tank last year. “And its revenue sources have a different composition from those of many other terrorist organizations.” From its beginning the group has been largely self-financing. Its members have proven both enterprising and ruthless in their search for cash.

ISIS adherents steal livestock, rob banks, and levy “taxes” on minorities, farmers and truckers. The group runs extortion and protection rackets within its territory, and has found great fiscal success in kidnapping foreigners for ransom. (France reportedly paid US$14 million for the release of four journalists in the spring of 2014, and the Italians $12 million for the freedom of two female aid workers in January 2015. This was in sharp contrast to U.S. and U.K. authorities, who steadfastly refused to deal—and saw their citizens beheaded before the cameras.)

The looting and sale of antiquities from archeological sites in Iraq and Syria has also turned into a lucrative side business. Many of the treasures are exported through Turkey and Jordan and eventually find their way into the hands of rich Western collectors.

The main revenue source for ISIS, however, remains the export of black-market oil. The flow, which the U.S. Treasury Department estimates brings in nearly $500 million a year, has hardly been affected by the months of U.S.-led bombing runs, as engineers have rapidly repaired damage to refineries and wells. The smuggling routes, via road and buried, border pipelines, are well-established, functioning much as they did back in the days of Saddam Hussein’s Iraq. It wasn’t until late October that the air coalition finally got serious about turning off the tap, launching a campaign—dubbed Tidal Wave II—with the stated goal of crippling eight major oil fields and two-thirds of ISIS-controlled processing sites. On Nov. 15, two days after the Paris attacks, U.S. A-10 and AC-130 gunships destroyed 116 tanker trucks near Deir al-Zour in eastern Syria. It was a sharp change of policy for the Americans, who had previously avoided targeting the transports for fear of killing their civilian drivers.

Efforts to stop foreign financial “donations” to the ISIS cause have also proven more complicated than expected. The UN Office for Coordination of Humanitarian Affairs has flagged the problem of aid funds that are being distributed in Syria without any sort of oversight or paper trail. As of late 2014, it was reported that big-name donors in the oil-rich Gulf states had given the terrorist organization at least $40 million, with much of the money flowing through Kuwait and Qatar, where there is no real enforcement of laws that prohibit such transfers. The problem may be even more widespread. At the G20 summit in Turkey this week, Vladimir Putin said Russian intelligence has identified 40 source countries for ISIS funding, including a number of G20 states.

In the wake of the attacks in France and Lebanon last week, and Russian confirmation that their Metrojet Airbus A321 was indeed brought down by a bomb, the measured approach to combatting Islamic State appears to be over. The speed with which the group has morphed into a force that is capable of launching, or at least supporting, large-scale attacks around the globe has spooked world leaders.

The military campaign against the would-be caliphate has escalated dramatically—both on the ground and in the air—and there is a sudden urgency surrounding the diplomatic efforts to bring the other players in Syria’s 4½-year civil war to heel. Last weekend in Vienna, the U.S., Russia and more than a dozen other interested nations hammered out a framework for peace negotiations, with formal talks between the regime of Syrian President Bashar al-Assad and rebels now set to start on Jan. 1. The plan calls for a ceasefire and an interim “unity government” within six months, then the drafting of a new constitution, and free and open UN-supervised elections by mid-2017. The accelerated timetable borders on delusional, but there was at least one reason for optimism. The Saudis and the Iranians—regional rivals who are backing opposing sides in Syria, and fighting another proxy war in Yemen—were both at the table.

“Vienna creates momentum toward dealing with ISIS, but the problem remains the two international camps—pro-Assad and anti-Assad,” says Randa Slim of the Middle East Institute, a non-partisan Washington think-tank. The Russians, she says, are signalling that they might be willing to let Assad’s fate be decided by the peace process. The Iranians, however, remain determined to keep their longtime ally in power. Slim has been facilitating less-formal “Track II” peace dialogues between all the major parties since late 2012. Positions remain entrenched, and there has been little progress, she says. “The situation we’re dealing with is very complicated,” says Slim. “And of all the regional conflicts and competition between the Iranians and Saudis, Syria is the toughest nut to crack.”

The heightened distrust between the Russians and Americans will also be difficult to overcome. Putin’s late September decision to begin his own air strikes, both against ISIS and in support of Assad’s forces, changed the complexion of the war overnight, and provided him with plenty of leverage at the negotiating table. “The Russians were sounding the alarm bells for quite some time,” Alexander Nekrassov, a former Kremlin adviser-turned-author, says from his home in London. “What keeps them awake at night are worries of a new fire in the Caucasus regions, that ISIS fighters are penetrating places like Chechnya.” Putin has repeatedly raised the spectre of Syria becoming a long-term failed state and terrorist incubator. “From the Russian perspective it’s very hard to understand the logic of taking Assad out and not having anyone to take his place,” says Nekrassov. “The West really hasn’t learned the lessons of Libya and Iraq.”

The bad blood and suspicion flow in both directions. “ISIS atrocities in Paris and the Sinai will not, unfortunately, contribute to the prospects for a political solution in Syria, unless and until Russia and Iran act in a manner consistent with what they know: that their client—Bashar al-Assad—has contributed significantly to the creation and the sustenance of this monster,” Frederic Hof, the Obama administration’s former special adviser on Syria, wrote in an email to Maclean’s. “If Russia and Iran were serious about fighting ISIS, they would start by getting their client out of the civilian atrocities business. And they would end by shuffling him and his extended family into exile.”

Obama’s stated goal in recent months has been to “contain” ISIS, offering civilian populations some protection and providing time for a negotiated Syrian solution to materialize. But the experts warn that air campaigns aren’t enough to attain that end, let alone prosecute the sort of “pitiless war” that François Hollande, the French president, has vowed in response to the Paris attacks. “The missing component has been the military track,” says the Middle East Institute’s Slim. “We need a limited number of [Western] boots on the ground and an exponential ramping up of materiel and financial support to rebel groups.” Hof, now a senior fellow with the Atlantic Council’s Rafik Hariri Center for the Middle East, calls for a “large and capable” international ground force to fight in eastern Syria, as a prelude to a regional peace deal. ISIS can be defeated militarily, he writes, but it “cannot be destroyed until there is legitimate governance in both Syria and Iraq.”

If the fight against ISIS is intensifying, it’s apparent that Canada will no longer be participating. This week, Prime Minister Justin Trudeau reiterated his commitment to soon bring home the six CF-18 fighters that have been involved in the air campaign since late last fall. The Liberal government will instead focus on beefing up its contribution to the training of local troops to fight the terror group on the ground in Iraq.

Such distinctions are surely lost on the Islamic State and its followers. The killings of soldiers in Saint-Jean-sur-Richelieu, Que., and Ottawa in October 2014, carried out by homegrown jihadis, came before Canadian planes had dropped a single bomb. And while Canada has so far avoided a mass terror attack like those in Paris, London, Madrid, Volgograd, Bali, Baghdad or New York, it is mostly a matter of good fortune. “To me, it’s unfair to expect perfection from intelligence agencies when you don’t expect the same level of perfection elsewhere. We don’t expect law enforcement to stop every murder, we don’t expect doctors to save every life, we don’t expect plumbers to fix every leak,” says Phil Gurski, an Ottawa consultant who spent three decades working for Canadian intelligence agencies. “I think Canadians should accept the reality that terrorism happens in the same way that car accidents happen, in the same way that murders happen: you do your utmost to stop them from happening, but to expect perfection is simply unreasonable.” Gurski estimates that the threat of ISIS—and its inevitable successors—could last another 40 to 50 years. “The attacks in Paris may lead to an incredible international response that just decimates these sons of bitches, but the ideology will still be there—and that is the thing that’s worrisome,” he says.

After all, in our interconnected world, even if the organization disappears, jihad will remain just a click away.

As caliphates go, Islamic State seems on track to be among history’s shortest. As its opponents have organized and hooked up with foreign patrons, ISIS has found it difficult to hold its sprawling territory. Yet it still draws strength from the region’s Sunni Arabs, who have been left with few other defenders or options.

“They accuse us all of being terrorists,” one Arab refugee from Tal Abyad, a predominantly Arab town on Syria’s border with Turkey, told Maclean’s last June, shortly after Kurdish forces routed fighters from Islamic State. “I’m more afraid of the Kurds than ISIS. I would rather live under ISIS rule, because at least they are working for the Sunnis.” Dozens of Arab families who spoke to the magazine were of the same mind: Islamic State, they said, was the least vile of the options before them. All said they would take their chances in Raqqa.

These were not violent extremists. They were families, with young children, who spoke passionately about their desire for peace. Most were poor farmers who simply wanted to return to their land and be left alone. But circumstances, they said, had forced them to pick sides.

Hobson’s choices have become Islamic State’s most potent ideological weapon. Whether in Iraq and Syria, where Sunni marginalization plays into their narrative of orthodox Islam against the world, or in Europe, where surging Islamophobia has left observant Muslims feeling cornered. “They are not fuelled by the idea of an Islamic caliphate without borders,” Lydia Wilson, a research fellow at the Centre for the Resolution of Intractable Conflict at the University of Oxford wrote after interviewing Islamic State fighters in Iraq. “Rather, ISIS is the first group since the crushed al-Qaeda to offer these humiliated and enraged young men a way to defend their dignity, family, and tribe.”

Anti-radicalization experts say defeating the ISIS ideology will mean altering an environment that somehow permits young men from Paris’ banlieues, or Brussels’ gritty Molenbeek neighbourhood, to believe they have more in common with people in Ramadi than their fellow citizens. And that such differences in religion, outlook and lifestyle somehow justify picking up a gun and massacring people out for a meal at a restaurant, or attending a rock concert.

Clearly, that’s a much more difficult task than it should be. Europe’s continuing financial crisis and the mass influx of migrants have helped polarize the continent’s politics and given rise to nationalist leaders like Geert Wilders of the Netherlands and France’s Marine le Pen, who thrive on division almost as much as their radical Islamic counterparts. Centrist parties have also been shifting right to blunt that political challenge. “Saying awful things about migrants has become normalized,” says Carla van Os, a researcher at the University of Groningen in the Netherlands.

Authorities seeking to respond to attacks like those in Paris—and prevent further ones— need to try and enhance security without fuelling the very sense of grievance and rage that gives birth to the threat.

According to an April 2015 report by the U.S. Congressional Research Service, as many as 20,000 foreign fighters have joined the Islamic State since 2011, with an estimated 3,400 of them hailing from Western nations. (According to the latest figures from the French government, 520 of its citizens are currently in Syria, battling for ISIS.) If the caliphate is indeed collapsing in Syria and Iraq, it could spell even more danger for the rest of the world. The Soviet withdrawal from Afghanistan in 1989 freed thousands of muhajadeen to return to their home countries and dream of further jihad. The end of Islamic State will be cause for celebration. But it will also be a victory that has the potential to foment something even worse.

—with Michael Friscolanti