THE descent from tourist destination to no-man’s land has been a short one on Kenya’s coast. The only foreign visitors of interest on the beach in recent months are Somali jihadists. They have taken over mosques, installed hate preachers and raised black flags. Local youngsters are joining their ranks by the hundred. Christians have been lined up in gravel pits or pulled off buses and shot by the dozen. The governor of Mandera, an ethnic-Somali Kenyan county, Ali Roba, describes the situation as “extremely hopeless”. At this rate the coast may come to resemble northern Nigeria. One Nairobi-based ambassador frets about the “birth of a Kenyan Boko Haram” (a reference to Nigeria’s most brutal group of Islamists).

After recent attacks in Tunisia, Europeans began worrying about extremists taking aim at them across the Mediterranean. But it seems more likely that the jihadist superbug will turn south. The Sahel, an arid belt on the southern fringe of the Sahara desert that stretches from the Atlantic Ocean to the Red Sea, has already caught the fever from Algeria and Libya.

Ever more places in sub-Saharan Africa are no-go zones, including parts of Cameroon, Chad, Nigeria and Niger. Northern Mali has been off-limits to outsiders (and especially Westerners) since an Islamist-backed uprising in 2012, despite a French military intervention in 2013 that stopped the jihadists from advancing on Mali’s capital. Recent attacks by Boko Haram have killed hundreds in Nigeria and Chad, prompting Nigeria’s president, Muhammadu Buhari, to dismiss his military chiefs.

On the continent’s eastern side, violent Islamism has crossed south of the equator, spreading as far as Tanzania. Using homemade bombs, handguns and buckets of acid, extremists have attacked Christian leaders and tourists. Tanzania has also become a transit point for European extremists. “Jihadi John”, a British member of Islamic State (IS) known for beheading people on camera, passed through Dar es Salaam, Tanzania’s biggest city, before heading to Syria.

More than a dozen sub-Saharan countries are now dealing with jihadism at home (see map). They include Cameroon, the Central African Republic, Chad, Eritrea, Ethiopia, Kenya, Mali, Mauritania, Niger, Nigeria, Somalia, Sudan, Tanzania and Uganda. Jihadist attacks in many places are a daily or weekly occurrence. Weapons are widely available, often left over from secular civil wars. Tens of thousands have died.

Sudan is a crossroads through which many extremists groups combine or swap men, material and know-how. A coup in 1989 brought to power a group of generals allied to high-minded Islamists of an earlier vintage who, two decades ago, played host to Osama bin Laden. Since then the regime has grown suspicious of unbridled Islamism, though it is not averse to co-opting it, too. The main university in Khartoum, the capital, has been a magnet for radical students. Some have moved on to battlefields to the north and east, following in bin Laden’s footsteps.

The two major brands of violent jihadism, IS and al-Qaeda, compete for the allegiance of various groups of African jihadists. Yet the connections between groups are more complex than mere pledges of fealty. Cross-border links often originate paradoxically not when extremists are strong, but when they are weak. During a crackdown on Boko Haram in 2009 many of its leaders went to Chad, Sudan and Somalia. Since then Sudanese Arabic voices have been heard in Boko Haram propaganda videos. The group’s main maker of car-bombs is Somali-trained. Mobile military tactics learned in Chad (known as “Toyota warfare”) have transformed Boko Haram’s modus operandi. When the group was in the ascendant last year, it turned its gaze across Nigeria’s border to the east, having recruited Cameroonians in leaner times.

Local defeats of Islamist groups, followed by their flight, are accelerating a continental metastasis. The cancer of jihadism in sub-Saharan Africa will probably spread outward from conflicts now underway involving groups in Libya and Nigeria; their members are likely to flee into the sandy expanse that covers much of Africa above the equator, as happened after French forces tried to wipe out extremists in northern Mali in 2013.

Borders in the Sahel have never had much meaning, and politics has long been intertwined with commerce. Jihadist groups such as Ansar al-Sharia, the Movement for Unity and Jihad in West Africa (MUJAO) and al-Qaeda in the Islamic Maghreb (AQIM) grew out of trans-Saharan smuggling networks. They are capable of traversing vast distances following centuries-old but obscure desert trade routes. “Their map is not one we know,” says an intelligence officer in Nigeria.

Although the extremist groups are backed by well-financed elites, they could not survive without popular support. Every one of them taps into well-known local grievances. From Mali and Nigeria to Kenya and Tanzania the story is the same: extremists emerge from and woo Muslim populations on the national periphery who are fed up with decades of neglect, discrimination and mistreatment by their rulers. Jihadists are able to exploit existing religious tensions and latch on to disgruntled Muslim communities.

In addition, the conflicts that they stir up have created ever bigger populations of refugees, who are either vulnerable to radicalisation or likely to cause the sort of resentment that fuels it.

Increasingly what drives African extremism is not just opportunity or firepower but ideology. No grand caliphate stretching from Mosul in northern Iraq to Maiduguri in north-eastern Nigeria is likely to emerge. Yet a distinct flavour of poisonous thinking has spread across thousands of miles. Islamism is the continent’s new ideology of protest.

As such it is almost uniquely powerful. African politics tends to revolve around tribal and ethnic loyalties. But that leaves a wide political space unclaimed. A group like the Somalis’ Shabab is able to position itself as “above tribe”.

An interactive guide to the Middle East's tangled conflicts Only genuine political competition could change this dynamic. Yet most ethnic and tribal leaders have little interest in upsetting their own hold on power. African and Western governments are thus left to counter jihadism by force of arms. France has set up a 3,000-strong rapid-response force in Chad with six fighter jets and 20 helicopters. America has built drone bases across the continent. Such brawn has little chance of succeeding alone. In Somalia the Western-aided fight against jihadists has made some progress. The Shabab has lost both members and territory. But it is still lethally active. Once operating purely in Somalia, it now seeps across the border into Kenya. In this endeavour it has found an unexpected (and unwitting) ally in government forces. In Kenya, as elsewhere, official brutality has been the best recruitment tool for extremists. Armies have locked up and tortured thousands without reason. Everyone knows a victim. More than 20 Muslim clerics have been killed along the Kenyan coast in the past two years. Yet the more governments feel under threat, the freer the rein they give their generals. This dynamic not only stirs opposition but also turns “fragile states into brittle ones”, warns Alex Vines of Chatham House, a British think-tank.

Correction: The original version of the map included some non-fatal incidents. This has now been changed.