A FEW months ago Barack Obama declared that al-Qaeda was “on the path to defeat”. Its surviving members, he said, were more concerned for their own safety than with plotting attacks on the West. Terrorist attacks of the future, he claimed, would resemble those of the 1990s—local rather than transnational and focused on “soft targets”. His overall message was that it was time to start winding down George Bush’s war against global terrorism.

Mr Obama might argue that the assault on the Westgate shopping mall in Nairobi by al-Qaeda’s Somali affiliate, the Shabab, was just the kind of thing he was talking about: lethal, shocking, but a long way from the United States. Yet the inconvenient truth is that, in the past 18 months, despite the relentless pummelling it has received and the defeats it has suffered, al-Qaeda and its jihadist allies have staged an extraordinary comeback. The terrorist network now holds sway over more territory and is recruiting more fighters than at any time in its 25-year history (see article). Mr Obama must reconsider.

Back from the dead

It all looked different two years ago. Even before the killing of Osama bin Laden in 2011, al-Qaeda’s central leadership, holed up near the Afghan border in Pakistan’s North Waziristan, was on the ropes, hollowed out by drone attacks and able to communicate with the rest of the network only with difficulty and at great risk. Al-Qaeda in the Arabian Peninsula (AQAP), its most capable franchise as far as mounting attacks on the West is concerned, was being hit hard by drone strikes and harried by Yemeni troops. The Shabab was under similar pressure in Somalia, as Western-backed African Union forces chased them out of the main cities. Above all, the Arab spring had derailed al-Qaeda’s central claim that corrupt regimes supported by the West could be overthrown only through violence.

All those gains are now in question. The Shabab is recruiting more foreign fighters than ever (some of whom appear to have been involved in the attack on the Westgate). AQAP was responsible for the panic that led to the closure of 19 American embassies across the region and a global travel alert in early August. Meanwhile al-Qaeda’s core, anticipating the withdrawal of Western troops from Afghanistan after 2014, is already moving back into the country’s wild east.

Above all, the poisoning of the Arab spring has given al-Qaeda and its allies an unprecedented opening. The coup against a supposedly moderate Islamist elected government in Egypt has helped restore al-Qaeda’s ideological power. Weapons have flooded out of Libya and across the region, and the civil war in Syria has revived one of the network’s most violent and unruly offshoots, al-Qaeda in Iraq, now grandly renamed the Islamic State of Iraq and al-Sham.

The struggle to depose the Assad regime has acted as a magnet for thousands of would-be jihadists from all over the Muslim world and from Muslim communities in Europe and North America. The once largely moderate and secular Syrian Free Army has been progressively displaced by better-organised and better-funded jihadist groups that have direct links with al-Qaeda. Western intelligence estimates reckon such groups now represent as much as 80% of the effective rebel fighting force. Even if they fail to advance much from the territory they now hold in the north and east of the country, they might end up controlling a vast area that borders an ever more fragile-looking Iraq, where al-Qaeda is currently murdering up to 1,000 civilians a month. That is a terrifying prospect.

No more wishful thinking

How much should Western complacency be blamed for this stunning revival? Quite a bit. Mr Obama was too eager to cut and run from Iraq. He is at risk of repeating the mistake in Afghanistan. America has been over-reliant on drone strikes to “decapitate” al-Qaeda groups: the previous defence secretary, Leon Panetta, even foolishly talked of defeating the network by killing just 10-20 leaders in Pakistan, Yemen and Somalia. The general perception of America’s waning appetite for engagement in the Middle East, underlined by Mr Obama’s reluctance to support the moderate Syrian opposition in any useful way has been damaging as well.

A second question is how much of a threat a resurgent al-Qaeda now poses to the West. The recently popular notion that, give or take the odd home-grown “lone wolf”, today’s violent jihadists are really interested only in fighting local battles now looks mistaken. Some of the foreign fighters in Syria will be killed. Others will be happy to return to a quieter life in Europe or America. But a significant proportion will take their training, experience and contacts home, keen to use all three when the call comes, as it surely will. There is little doubt too that Westerners working or living in regions where jihadism is strong will be doing so at greater risk than ever.

The final question is whether anything can be done to reverse the tide once again. The answer is surely yes. When Mr Bush declared his “war on terror”, his aim was the removal of regimes that sponsored terrorism. Today, the emphasis should be supporting weak (and sometimes unsavoury) governments in Yemen, Somalia, Iraq, Libya, Mali, Niger and elsewhere that are trying to fight al-Qaeda. Even Kenya and Nigeria could do with more help. That does not mean a heavy bootprint on the ground, but assistance in intelligence, logistics and even special forces and air support. Most of all, it means more help to train local security forces, to modernise administrations and to stabilise often frail economies.

The most dismaying aspect of al-Qaeda’s revival is the extent to which its pernicious ideology, now aided by the failures of the Arab spring, continues to spread through madrassas and mosques and jihadist websites and television channels. Money still flows from rich Gulf Arabs, supposedly the West’s friends, to finance these activities and worse. More pressure should be brought to bear on their governments to stop this. For all the West’s supposedly huge soft power, it has been feeble in its efforts to win over moderate Muslims in the most important battle of all, that of ideas.