By any measure, Africa's fight against terrorism has been a failure.
Since it launched the fight in earnest nearly three decades ago in 1992, in the aftermath of a wave of violence from Islamist groups in Algeria, there has been a dramatic rise in incidents and fatalities perpetrated by militant groups. From 2009, for example, there has been a fourfold increase in the number of attacks by such groups, and an 850% increase in deaths. Meanwhile, the footprint of militant groups has expanded in a broad arc from the Horn of Africa to northeast Nigeria, encompassing much of North Africa and the Sahel in the process.
Groups such as al-Shabaab, Boko Haram and al-Qaeda in the Islamic Maghreb (AQIM) continue to flourish despite repeated military onslaughts, and both al-Qaeda proper and the Islamic State militant group (ISIS) have made a concerted effort to expand their presence on the continent, both directly and via proxies.
Yet in the inability of policymakers to curb the rise of militant groups in Africa lies a lesson for how to deal with these issues in the future. After two decades of trying and failing to counter militancy on the continent, we now know what doesn't work. We know what not to do.
All too often, innocent civilians are caught up in the dragnet of counter-terrorist operations
And as the global war on terror enters a new phase - particularly given the hawkish language emanating from US President Donald Trump's White House - it has never been more important to recognise these errors and make sure they are not repeated.
In hindsight, it is clear that three mistakes were made.
The first, and most significant, has been to prioritise a military and security-led response to militant threats, which has sometimes been accompanied by a callous disregard for rule of law and basic human rights. The injudicious and unrestrained use of force means that, all too often, innocent civilians are caught up in the dragnet of counter-terrorist operations.
In some countries - such as Kenya and Nigeria - torture and extrajudicial killings have become commonplace, even though these tactics have repeatedly been proved to be counter-productive.
For example, research conducted in Kenya by the Institute for Security Studies found that the majority of recruits to local militant organisations had been motivated by incidents of injustice suffered at the hands of Kenyan security forces. For policymakers, the lesson here is simple: indiscriminate bullets and beatings actually help, rather than hinder, militant groups in the long run.
This is a crucial moment in the fight against militancy in Africa
The rise of Boko Haram in Nigeria is the clearest example of this. In July 2009, the group's founder and then leader, Mohammed Yusuf, was killed in a crackdown by Nigerian security forces along with dozens of his followers. The perceived injustice of this incident was a major factor in Boko Haram's subsequent transformation from a dangerous but moderate Islamist group to a radical militant organisation.
Another strategic error has been to allow global narratives on terrorism to dictate local responses, in particular by adopting the rhetoric and tactics espoused by the United States in its war on terror. This is understandable, given that Washington has actively enlisted the assistance of various African governments and disbursed billions of dollars in the process as its world view on militant groups expanded in the wake of 9/11. But it is a mistake.
Nowhere is this more obvious than in Somalia, where the United States is a major funder of the African Union Mission in Somalia (AMISOM). All too often, however, America's emphasis on military- and security-led responses - an approach enthusiastically adopted by regional governments - means that AMISOM's efforts have been directed towards containing and suppressing al-Shabaab, rather than working towards a stable, peaceful and inclusive Somalia.
This fixation on global narratives is also present in the way Africa's militant groups are routinely linked to larger, more international groups such as al-Qaeda and ISIS. While it is true that links do exist, they are often more tenuous than usually suggested. Boko Haram, for example, may have declared its allegiance to ISIS, but that does not mean that ISIS leader Abu Bakr al-Baghdadi is calling the shots in Nigeria. By focusing on the international rather than local roots of the problem, leaders are missing opportunities to improve the situation - and, sometimes, avoiding the responsibility to do so.
With the rise of populist governments, Africa will be a major theatre in the war on terror
To their credit, African leaders know that things must work differently. At the African Union (AU), member states agreed to a comprehensive counter-terrorism framework that prioritises regional cooperation and reaffirms the continent's commitment to upholding human rights. This is good policy. Or at least it would be, if it were implemented. Unfortunately, few states are actively adhering to the AU's progressive guidelines. This too must change.
This is a crucial moment in the fight against militancy in Africa. With the rise of insular, populist governments in the developed world, and a distinct hardening in rhetoric from world leaders (the former US administration of Barack Obama, although it did not always practice what it preached, recognised the need for a nuanced, holistic response to terrorism) Africa will continue to be a major theatre in the war on terror.
But Africa cannot afford to get counter-terrorism wrong again, and it must resist the hawks and securocrats who urge African governments to repeat the brutal, military-led counter-terrorism policies that have failed so spectacularly over the last three decades. Instead, a holistic, multi-level approach that addresses the real concerns of citizens and engages civil society, community leaders and religious institutions at all levels of society is required. It's not just the right thing to do, from a moral perspective - it is also good strategy.
Anton du Plessis, Executive Director, ISS, and Simon Allison, ISS Consultant
This article was first published by Newsweek.