THE atrocity visited on Nairobi’s Westgate shopping centre by al-Qaeda’s Somali affiliate, the Shabab, was a bloody reminder that reports of the terrorist network’s demise have been much exaggerated. From Somalia to Syria, al-Qaeda franchises and jihadist fellow travellers now control more territory, and can call on more fighters, than at any time since Osama bin Laden created the organisation 25 years ago.

The September 21st raid and the subsequent three-day stand-off left at least 67 people dead and nearly 200 injured (see article). The attack resembled in some ways that perpetrated by Lashkar-e-Taiba, a Pakistani outfit also linked to al-Qaeda, in Mumbai in 2008: non-Muslims were singled out for execution; hostages were taken to prolong the drama; well-trained fighters were able to hold off security forces for a considerable time; and, as at least six dead Britons bear witness, the killers picked a target with a Western clientele. Such attacks are easier to plan and execute than blowing up airliners and more glamorous (for the fighters involved) than suicide bombings. As a result Western intelligence agencies fear that they may become increasingly popular.

The Shabab’s attack is not a sign of strength. Ousted from Somalia’s capital, Mogadishu, last year by a UN-backed African Union force that includes some 5,000 Kenyan troops, subject to American drone strikes from nearby Djibouti and suffering internal divisions after the decision by the group’s emir, Ahmed Godane, to merge fully with al-Qaeda in 2011, the Shabab has been under severe pressure. But it has a hunkered-down resilience. The Shabab has proved impossible to dislodge from its southern Somali redoubts and has promised that the Westgate attack will be followed by others of its kind.

Life after Abbottabad

The Shabab’s ability to strike back after a serious drubbing mirrors that of al-Qaeda at large. In July 2011, two months after the Abbottabad raid that killed bin Laden, America’s then defence secretary Leon Panetta boasted in Kabul that America was “within reach of strategically defeating” the network. Mr Panetta said that intelligence gathered in Abbottabad pointed to an organisation that was broke and reeling from American drone strikes. With a bit of further effort aimed at ten to 20 key leaders in Pakistan, Somalia and Yemen, Mr Panetta went on, “We can really cripple al-Qaeda as a threat to this country.”

Specifically, America’s leaders thought that such assassinations would leave the organisation incapable of carrying out complex plots against targets in the West. “Lone wolf attacks” carried out by misfits and madmen indoctrinated by al-Qaeda over the internet might continue; “spectaculars”were increasingly beyond the beleaguered organisation’s abilities.

Al-Qaeda was not only getting killed in the field. The tide of history seemed to be against it. In the first half of 2011 the Arab spring had shown that oppressive regimes that had resisted al-Qaeda, such as those of Egypt, Tunisia and the Yemen, could be removed by peaceful protests. Political parties with an Islamist agenda could contest and even win democratic elections without the West stepping in to stop them. This, many Western analysts and officials held, meant that al-Qaeda’s day was done.

Two years after Mr Panetta’s brave words, though, America’s State Department abruptly announced that it was closing 19 diplomatic missions across the Middle East and north Africa, and a global travel alert was issued to all American citizens. In early August America’s National Security Agency had intercepted communications between Ayman al-Zawahiri, bin Laden’s successor as head of al-Qaeda, and Nasser al-Wuhayshi, the leader of its Yemen-based affiliate, al-Qaeda in the Arabian peninsula (AQAP), in which they discussed putting into action one or more terrorist operations against American interests. Mr Zawahiri recently appointed Mr Wuhayshi, once bin Laden’s secretary, as general manager of al-Qaeda, putting him in overall operational command of the network.

The exposure of the plotters may have helped thwart their plans. But the seriousness with which the threat was treated casts doubt on the story of an isolated and ineffective core increasingly irrelevant to the region’s broader conflicts. The central leadership has lost many people, and its ability to communicate securely with the rest of the network has been severely degraded. But Mr Zawahiri, Mr Wuhayshi and their colleagues still have substantial ideological and some practical influence over the wider movement. Mr Zawahiri does not have the charisma of bin Laden, and some intelligence sources stress the emergence of a new generation of younger jihadist leaders who pay only lip-service to his authority. But the emirs of many al-Qaeda affiliates, such as the Shabab’s Mr Godane, have sworn allegiance to him.

Black flags in Aleppo

Other jihads are available

Al-Qaeda and its fellow travellers, including militia groups under the umbrella name of Ansar al-Sharia (Partisans of Islamic Law)in Yemen, Libya, Tunisia, Mali and Egypt that both compete and co-operate with the organisation, have recovered momentum and self-confidence as the hopes invested in the Arab spring have withered. Indeed, the reverses of the Arab spring have been a boon to it.

Take Egypt. After the coup that toppled President Muhammad Morsi in July, Mr Zawahiri posted a 15-minute message on jihadist websites arguing that “the crusaders” in the West and their allies in the Arab world will never allow the establishment of an Islamist state. The Egyptian-born Zawahiri went on to urge “the soldiers of the Koran to wage the battle of the Koran” in Egypt. Al-Qaeda has always despised the Muslim Brotherhood, of which Mr Morsi is a part, but in these circumstances it is happy to make common cause. Its fighters are already allying themselves with Bedouin bandits and insurgents in the Sinai who make daily attacks on Egypt’s army.

It is too soon to say how many young Egyptians will heed Mr Zawahiri’s call. While violence may beget violence, there are other extremists on offer, such as Eyad Qunaibi, a Western-educated Jordanian. But at least some Islamists who would previously have rejected al-Qaeda will probably now turn to it. To see how frightening that prospect might be, look to the biggest gift the Arab spring has given al-Qaeda: the increasingly sectarian civil war in Syria.

The prospect of overthrowing Bashar Assad is catnip to jihadists; his Alawite regime is an heretical abomination to the hyper-orthodox Salafis from which al-Qaeda draws its support. Western intelligence thinks most of Syria’s effective rebel militias may now be jihadist, with thousands of fighters from other Muslim countries and hundreds from Europe, especially Britain, France and the Netherlands.

The Islamic State of Iraq and al-Sham (ISIS), formerly al-Qaeda in Iraq (AQI), has recently pushed into eastern Syria from Iraq, following a resurgence there that is part of the more general pattern of ineradicability. After 2008 the “Anbar Awakening” of tribal leaders and the “surge” strategy led by General David Petraeus seemed to have defeated the spectacularly bloody AQI insurgency instigated by the psychotic Abu Musab al-Zarqawi. But in the past 18 months, under its new emir, Abu Bakr al-Baghdadi, ISIS has brought veteran fighters back into the field through daring jailbreaks and has more than tripled the rate of its attacks against government targets and the majority Shia community. According to Iraq Body Count, an independent monitoring service, nearly a thousand civilians were killed in July, in August and in September to date (see chart). Al-Qaeda wants to bring Iraq, Syria and Lebanon together into a single “caliphate”, and ISIS uses foreign fighters drawn to Syria on both sides of the porous border with Iraq. It has also tried to merge with Jabhat al-Nusra (JAN), one of the most militarily formidable rebel militias (and the one with which Mr Qunaibi is associated). In April Mr Baghdadi issued an audio message claiming that JAN was an al-Qaeda funded and trained entity—which is true—and that it would be absorbed into the Iraqi group under his command. Mr Baghdadi claimed that JAN’s leader, Abu Muhammad al-Golani, was one his deputies. Mr Golani has appeared less keen on a full merger; as was the case with the Shabab in Somalia, not everyone in JAN welcomes closer association with al-Qaeda. The prospect may encourage some JAN fighters, particularly native Syrians, to shift to Ahrar al-Sham, a considerably larger and marginally more moderate Salafi militia. Mr Golani claimed in June that Mr Zawahiri wanted JAN to retain a degree of autonomy. Mr Zawahiri may be worried about the foreigners, usually the most extreme of the extreme, gravitating to ISIS. As AQI showed, some levels of excess will alienate al-Qaeda’s broader constituency.

Spring has sprung

On September 25th JAN and a dozen other militias announced their split from the Western-backed leadership of the Syrian opposition; they made no mention, though, of including ISIS in their new grouping. Al-Qaeda in Syria is thus split, with Mr Baghdadi or Mr Golani, or possibly both, showing less allegiance than the core would wish. At the same time it is killing its enemies and recruiting fighters on a grand scale; and having recently taken Azaz in northern Syria from other rebels, ISIS now sits on a NATO border.

For the time being, ISIS and JAN are focused entirely on the would-be caliphate of the Levant. Most of the network’s affiliates are similarly engaged in regional struggles, the most extensive being that of al-Qaeda in the Islamic Maghreb, the north African branch. AQIM is seeking to make use of Libya’s post-revolutionary chaos, and weapons from Muammar Qaddafi’s former arsenal, to create an “arc of instability” across the Sahara and the Sahel. It provides help and advice to jihadist organisations from Boko Haram in Nigeria to the Shabab in Somalia.

In 2012 AQIM commanders allied to an indigenous insurgent group, Ansar Eddine, took control of the northern half of Mali. They ruthlessly implemented sharia law and picked an unnecessary fight with the National Movement for the Liberation of Azawad, a grouping of rebel Tuaregs. Their Algeria-based emir, Abu Musab Abdel Wadoud, feared that this would result in a backlash among the local population and reprisals from overseas. He was right; a French-led coalition took back the north earlier this year. But AQIM still has bases in northern Niger and southern Libya. And since the Ansar al-Sharia attack on the American consulate in Benghazi that killed Ambassador Christopher Stevens and three others a year ago, some of the more violent Libyan militias have been drifting under its sway. A Libyan intelligence official reportedly likened it to “a swarm of bees” finding their way to a new queen.

While AQIM is committed to carrying out attacks against France and Spain, it has not yet acted outside its home region. This is true of most of al-Qaeda’s current affiliates and fellow travellers; they are focused for now on “the near enemy”, not “the far enemy”. The exception is AQAP, which intelligence sources see as the only affiliate that currently has both the intent and the capability to carry out sophisticated operations against the West.

An intense drone campaign has killed several of AQAP’s senior leaders; its second-in-command, Said al-Shihri, died on July 16th. Yemeni government operations have driven it out of some of the southern tribal areas it overran in 2011. But it has lost none of its ambition. According to Daniel Green of the Washington Institute for Near East Policy, AQAP still has a “pervasive infrastructure” in Yemen. It is reconstituting its forces by retreating to parts of the interior it sees as safe; it has killed over 90 Yemeni officials and tribal leaders since 2012. It is expanding its criminal fund-raising activities and has made incursions into several governorates in which it had not previously operated to show its strength.

Given the fragility of the new Yemeni government of Abdo Rabbu Mansour Hadi, an army that is split into factions and fears that civilian casualties in drone strikes are driving the local population into the arms of the jihadists, AQAP looks able to maintain its special place in al-Qaeda. It is close to rich Gulf sheikhs with Salafi sympathies who are happy to back it. It still attracts sophisticated operatives such as Ibrahim al-Asiri, the Saudi bomb-maker who was behind the 2010 plot to put bombs disguised as printer cartridges on planes headed for Chicago. Reports that Mr Asiri, dubbed by intelligence agencies the world’s most dangerous terrorist, was wounded in a drone attack in August have not been confirmed.

Mr Zawahiri, not dead yet Despite attempts by Western intelligence agencies to close it down, AQAP also continues to produce an online magazine, Inspire, that was started by Anwar al-Awlaki and Samir Khan, both killed in a drone strike two years ago. Awlaki, a charismatic propagandist and, like Khan, an American citizen, was determined to recruit Muslims in the West to al-Qaeda’s cause. Umar Farouk Abdulmutallab, a Nigerian who had studied in London and tried to blow up a Detroit-bound plane on Christmas Day 2009, was radicalised by Awlaki. So was Nidal Hasan, the army psychiatrist who killed 13 people at Fort Hood, Texas. The same pattern of retreat followed by recovery seen in Yemen and Iraq—and which may yet be seen in northern Mali, where Mr Wadoud has plans for a return less alienating to locals—could also apply to the al-Qaeda core group in Pakistan. Bruce Riedel, who has advised four presidents and is now at the Saban Centre for Middle East Policy in Washington, DC, recently warned that al-Qaeda in Pakistan remains embedded in a network of local support groups from the Taliban to Lashkar-e-Taiba. After the departure of NATO combat forces in 2014 it may be able to regenerate itself, rather as ISIS did in Iraq. As well as its bases in North Waziristan, al-Qaeda already has relatively safe havens on the other side of the border with Afghanistan. Thomas Sanderson of the Centre for Strategic and International Studies, also in Washington, says al-Qaeda and its allies in Pakistan are weaving a narrative that equates America’s post-2014 withdrawal with the mujahideen defeat of the Soviet Union, another superpower with feet of clay, 25 years earlier. Mr Zawahiri may not see out the next couple of years; America will probably still have drones in the region after 2014, even if the intelligence that guides them will no longer be as good as it has been. If he does survive, many doubt that he can restore the central leadership’s grip on al-Qaeda’s affiliates to what it once was. What is surprising is that he may well have the opportunity.

The base of the pillar

In May this year, Barack Obama declared that core al-Qaeda was “on the path to defeat” and “their remaining operatives spend more time thinking about their own safety than plotting against us”. The ability of al-Qaeda to strike targets in the West is undoubtedly much less than it once was, as is the life expectancy of any given leadership cohort. But that is not the whole story. As one counter-terrorism intelligence source recently observed: “Tactically, we may have defeated the central leadership, but strategically, they are winning.”

While attacks on the far enemy are important both as a deterrent and as a source of jihadist inspiration, they are not al-Qaeda’s main purpose. Its overriding aim remains, as it has been since bin Laden saw the retreat of the Soviet Union, the creation of a new caliphate across the Islamic world based on unswerving adherence to sharia law. That requires the corrupting influence of the “Zionist-Crusader alliance” in the region to be extirpated and all apostate Muslim governments removed.

Seen from that point of view, things are not going badly. Al-Qaeda believes America is in retreat not just in Afghanistan but also across the Middle East. The poisoning of the Arab spring has given it new purpose and ideological momentum. Al-Qaeda itself may be divided and in some places depleted. It may be shunned by some with similar ideologies, and its affiliates may increasingly ignore its ageing leadership. But the Salafi jihadist view of the world that al-Qaeda promotes and fights for has never had greater traction.