The trajectory of instability and terrorism in Libya will determine the future of North Africa and could affect the entire Mediterranean rim; possibly for decades. Time is running out for effective preventive action.
Comparisons can be dangerous, but Libya could easily become the Somalia of the Maghreb - or even worse, North Africa's version of the proxy war in Syria that now involves the United States of America (USA), Russia, Turkey, Iran, Saudi Arabia and a host of client states.
Certainly the Islamic State sees Libya as its most promising safe haven. As the spread of the Islamic State is stemmed and then rolled back in Iraq and Syria, it is relocating key combatants to Libya. From here it is working to expand its territorial control and training bases, at the same time making large sums of money from trafficking refugees (not yet from oil) and seemingly also consolidating its control over areas in the west, as well as in Sirte.
In Iraq, the Islamic State gained enormous traction by exploiting the resentment against the disastrous decision by the USA to invade Iraq. The recruitment of Ba-athist military and intelligence officers from former dictator Saddam Hussein's regime into the structures of the Islamic State transformed it from a fringe grouping into a formidable force; eventually able to rout the Iraqi military despite its US backing and support.
In Libya, the Islamic State stronghold in the coastal city of Sirte, Muammar Gaddafi's home town, potentially draws upon the same type of resentment. Like in Iraq, the Islamic State and Gaddafi loyalists share the belief that the new political leaders in Libya (there are currently two governments that the United Nations [UN] are trying to reconcile) are being imposed by the West.
While events in Libya have some parallels with Iraq, these developments also share a number of important characteristics with Somalia, where it took more than a dozen peace agreements and two decades before the African Union (AU) was able to create the conditions for a halting peace. It did so after three failed international interventions backed by the might of the US military.
The AU eventually deployed AMISOM (the AU Mission in Somalia) in support of a fragile political process. This calculated gamble took several years and thousands of casualties before legitimate politics gained a foothold, eventually allowing the international community to back African efforts.
For Libya, the most important lesson to be learnt from Somalia is the need for a speedy political agreement that will allow for the deployment and training of sufficient ground forces to stabilise the situation, provide security and change the facts on the ground. Libyans will only support, or come around to support, a new unity government if they are secure. Since the country is awash with arms and rebels, that won't be easy.
Like in Somalia, Libyans are a tribal and fractured bunch, and probably only united in their resentment of foreign engagement. Even the Islamic State is finding it hard to enter places such as Derna, where local forces expelled them from within the city. This domestic resistance may change. As more Libyan combatants return home from Syria where they fought against Bashar al-Assad, the benefit of local knowledge, contacts and fighters could undercut domestic resistance against the Islamic State.
The growing prominence of the Islamic State in Libya is predictably drawing much attention from Western powers - alarmed at the possibility of a terrorist launch pad being established just across the Mediterranean from Europe. Eventually only Libyans can and should provide that security, but in the meantime external support is urgently needed. The dilemma is that the wrong type of external intervention in Libya, particularly from the West, could exacerbate the problem.
As has been the case elsewhere, the inevitable collateral damage that accompanies US and other aerial attacks intended to 'take out' key terrorists (without first being legitimised through due process, or as part of a political process) will inflame tensions. It could also drive recruits to join the Islamic State and its local allies, as happened in Iraq.
Libya's leaders and its public have been fed an unending diet of anti-Western rhetoric for decades. Gaddafi went as far as supporting terrorist groups in Europe (such as the Red Army Faction, the Red Brigades and the Irish Republican Army) - even trying to build a nuclear arsenal and chemical weapons, allegedly to counter the nuclear arsenal of Israel.
In 1986, in response to an explosion at a disco frequented by US soldiers in West Berlin, Ronald Reagan ordered the bombing of Libya. Revenge followed two years later with the downing of Pan Am Flight 103 over Lockerbie - an act for which the Libyan government eventually accepted responsibility and paid compensation.
It is against this background that, late last year, a US strike in eastern Libya reportedly killed Abu Nabil al-Anbari - a veteran Iraqi military officer believed to have been sent to Libya to organise and lead the Islamic State there. Two weeks ago, on 19 February, the US conducted its most recent air attack in Libya. More than 40 were killed in the attack which targeted Islamist militants in Sabratha, just 70 km from the Tunisian border. The Islamic State has been using the area mostly to train recruits from Tunisia.
A few days ago, a senior Libyan military commander acknowledged that French special forces and military advisers were helping to coordinate Libyan forces fighting the Islamic State in the eastern city of Benghazi. Earlier Italy - a former colonial power - announced that it would allow the US Air Force to use a base in Sicily to carry out drone strikes.
More extensive military involvement, including training missions or a proposed Italian-led stabilisation force, requires an internationally recognised government.
Much depends on the success of the UN-backed negotiations to create a single government. The agreement could pave the way for external assistance. Exactly how that support will be provided is unclear, but the most desirable outcome must be a sufficiently large Afro-Arab ground force that can restore stability in key population centres.
This is a huge task and significant combat capabilities, dominance of the air and sea and sufficient ground forces will be needed to do the job. The North Atlantic Treaty Organization (NATO) could quite readily provide key stand-off assets such as attack helicopters and other force multipliers, but it's the absence of ground forces that is proving much more difficult. The choices appear dismal whichever way one looks, but the longer it takes to deploy ground forces to work with those of a government of national unity to build domestic security capacity, the more difficult and messy the subsequent process.
In the absence of a political settlement, unleashing the Americans (or NATO) on the Islamic State to disrupt its spread will likely end in a disaster, as has happened almost everywhere else. Without the ability to secure populations, isolated surgical strikes on the Islamic State will rapidly increase rather than decrease their support.
Thus far, the AU has largely been absent from Libya, leaving the UN - under its special representative and head of the UN support mission there (now Martin Kobler) to try and herd the two governments (based in Tripoli and Tobruk, respectively) towards a peace agreement. Beyond regular statements from the AU Peace and Security Council, the only visible action has been the appointment of Tanzania's former president, Dr Jakaya Kikwete, as the AU High Representative for Libya. This is a blind spot that needs correction.
Libya presents as many dangers and challenges to Africa as it does to Europe. It underscores the importance of maintaining stability in Algeria, which is under pressure from within, and now also suffering from the economic impact of a depressed oil price. The imminent succession challenge to an elderly and sickly President Bouteflika could, in this context, prove disruptive.
Under current conditions, a crisis in Algeria would reverberate throughout the region, including in Tunisia and across the Mediterranean into southern Europe. In the past, Gaddafi exported instability to Chad and Sudan (among others), and recent events in Libya that followed the Arab Spring infected Mali and Sudan.
What happens in Libya will reflect across the entire Sahel, from Morocco in the west to Somalia in the east. Without adequate preventive action, Islamic State-aligned forces could potentially link Boko Haram in Nigeria across the Maghreb to al-Shabaab in Somalia.
Such a worst-case scenario would make Syria or Somalia seem an easy challenge.
Jakkie Cilliers, Head, African Futures and Innovation Section, Institute for Security Studies