Words matter, particularly after the past decade of western intervention in Muslim countries, and particularly when uttered by a British prime minister. After such a history of sustained and repeated failure one would have thought David Cameron would choose his words with care in the aftermath of the attack on the Algerian gas plant. The guiding principle of any response, western or regional, to Islamic militancy should be clear by now: don't make it worse; don't talk about global wars, existential threats to "our way of life", conflicts that could last for decades, spreading to new continents. From invasions that triggered civil wars, from counter-terrorism that blundered into counter-insurgency, the twin follies of enlarging the battlefield and of swelling the ranks of potential combatants might finally have revealed themselves. After so many years of fruitless war, a British prime minister might have been expected to unpick the narrative of a clash of civilisations.

Mr Cameron's gut response on Sunday to the Algerian attack bore the unmistakable echo of these Bush-era tropes. His second, in a Commons statement on Monday, retreated rapidly, and wisely, from this terrain. He talked instead of patient, intelligent and resolute approaches. He acknowledged the existence of different insurgent groups in north Africa with local leaderships and agendas, not all suffused with the same ideology. He recognised how lack of governance, legitimacy and accountability fuelled these conflicts, and the key role that politics and mediation will play in isolating the groups that carried out last week's attack. We will wait and see which approach wins out.

The continuing failure of al-Qaida to achieve its aims in the Muslim world is a political not a military one, as Osama bin Laden himself realised. The cause was too global. It was fatally weakened by local specificity. If the tide turned against al-Qaida and its offshoots it was because local populations in Iraq, Jordan, Turkey, Indonesia, Saudi Arabia did. If the overthrow, which al-Qaida so assiduously worked for, of western-backed Arab dictatorships produced Islamist-led coalitions that rejected violence, drew their legitimacy from the ballot box and embraced religious pluralism – particularly in Egypt, the homeland of al-Qaida's current leader – it is because al-Qaida's most potent weapon, its ideology, backfired on home turf. It alienated even more Muslims than the foreign interventions did, which is saying something. Where counter-terrorism worked, it was usually done by levering the alienation that al-Qaida's methods created.

Before the borderlands of Algeria, Mali and Niger reverberate to the daily sound of CIA-operated drones, it is worth drawing some obvious conclusions: Mali remains the fulcrum, and the danger of the current crisis was well signposted by those who knew how important it was to the region. Its internally displaced refugees need protection from rebel reprisals. The coup leader Amadou Sanogo should be pressed to stand down, and an interim legitimate government formed. A west African peacekeeping force should urgently be assembled. In the major urban centres of Gao, Timbuktu and Kidal, a referendum should be held on the future status of the region. The retaking of the north should not be allowed to degenerate into revenge for previous defeats of the Malian military. Tuareg civilians should not be conflated with rebels or Islamist groups. While the Malian military needs French and UN frontline support, this is exactly the time to be reinforcing these messages. An African intervention needs to impose a straitjacket on the Malian military, as the price for helping it defeat an extremist enemy.

The danger of a drones-based response is clear for all to see. The ranks of militants are easily replenished when the fire of the conflict spreads. Limiting its spread requires a different response. It remains to be seen just how many Somali, Afghani, Iraqi and Yemeni mistakes the international community is prepared to repeat in Mali.