Editor’s Note: After the United States helped overthrow Muammar Qaddafi in 2011, Libya was put on the back burner of U.S. policy even as its problems mounted. Moments of horrific anti-U.S. violence, like the attack on the U.S. consulate in Benghazi in 2012, grabbed attention, but the myriad problems plaguing the country were often ignored even as its fires burned hotter and hotter. Indeed, for those who thought things could not get worse, Libya may now host an Islamic State presence. Frederic Wehrey, a senior associate in the Middle East Program at the Carnegie Endowment for International Peace, offers us an incisive and comprehensive look at the Libya challenge today, drawing on his recent field work as well as his deep knowledge of this troubled country to offer a range of recommendations for policymakers.

(NOTE: The Foreign Policy Essay is traditionally published every Sunday, but because many folks will soon be traveling for the holidays, we decided not to wait until Sunday to publish this piece. We hope you have a wonderful break and a happy new year. We will return with a new Foreign Policy Essay on January 4, 2015.)

***

The Islamic State has come to Libya. The very sentence is enough to ring alarm bells that the fractured country—long neglected by Washington—is now a North African “colony” of the jihadist behemoth. A recent article in Newsweek claims that “Libya’s internal fighting could push [it] into the arms of the ever-opportunistic Islamic State.” But will it? And how can the United States prevent this from happening in a way that does not make things worse?

Here is what we know so far: Libya has long served as a source of foreign fighters for Syria, with some estimates placing the total number of Libyans involved at roughly 500. Some have joined Jabhat al-Nusra, some the Islamic State, while still others are fighting with non-jihadist groups. The return of Libyan foreign fighters from the conflict has long been a concern. In the spring and summer of this year, the pace of the jihadist return picked up, spurred in part by the outbreak of factional fighting in Benghazi.

In early October 2014, the Darnah-based Islamic Youth Shura Council (IYSC) pledged loyalty to the Islamic State, declaring eastern Libya to be a province of the Islamic State. It was the first such pledge by a Libyan jihadist group, facilitated by the return to Libya of a group of pro-Islamic State Libyan jihadists from Syria, the so-called Bitar Battalion, and the later arrival of Yemeni and Saudi emissaries from the Islamic State.

In the ensuing weeks, the IYSC tried to copy the more draconian functions of the Islamic State’s governance, setting up its own morality patrols, convening Shari‘a courts, and conducted the first public execution in Libya since Qaddafi’s overthrow. On November 12th, the self-styled caliph of the Islamic State, Abu Bakr al-Baghdadi, accepted the oath of the IYSC, urging Libyans (along with Algerians, Tunisians, and Moroccans) to “fight the secularists.”

On December 4th, the commander of the United States Africa Command announced that a “couple hundred” militants are present in Islamic State training camps in eastern Libya. Retired General John Allen, the U.S. special envoy for countering the Islamic State, later added that the United States is uncertain if the camps are the result of rebranding by an existing Libyan group or a new initiative by the Islamic State.

Taken in sum, these are worrisome new developments in Libya. But what they mean for the Islamic State’s operational reach or strategic depth remains unclear. Like everything else in the country, the jihadist field in Libya is highly fragmented and hyper-localized. And the rise of the Islamic State has stirred significant debates within this fractured community about how to respond.

The most powerful jihadist faction in the east, the U.S.-designated terrorist organization Ansar al-Shari‘a in Benghazi, Sirte, and Ajdabiya—which was involved in the 2012 attack on the U.S. diplomatic outpost in Benghazi—and its militia allies in the Benghazi Revolutionaries’ Shura Council have not pledged loyalty to the Islamic State. In Darnah itself, the IYSC has faced an armed challenge from another local militia, the Abu Salim Martyrs’ Brigade, which although radical in outlook is largely nationalist in orientation and rejects the Islamic State’s caliphate. The Brigade’s founder recently announced the formation of a rival coalition of Darnah-based militias to oppose the IYSC—the so-called Shura Council of Darnah Mujahidin.

Terrorism Entrenched in Civil War

What makes Libya’s terrorist threat so confounding is that it is deeply embedded in a broader, more complex power struggle that has effectively split the country’s nearly nonexistent political and security institutions.

Since the summer of this year, Libya has been wracked by civil war with the launch of Operation Dignity—a coalition of military units, Qaddafi-era military officers, eastern tribes, federalists, and Zintani militias in the west, led by retired General Khalifa Hifter. The immediate goal for Operation Dignity was to rid Benghazi of Islamist militias including Ansar al-Shari‘a and restore security in the troubled city, which had been rattled by a spate of assassinations. But a broader unstated goal was to reshape Libya’s security sector and political institutions to privilege the Qaddafi-era officer class and allied technocrats, while excluding the militias, younger Islamists, and Misratan factions. Hifter’s forces enjoy support from the internationally recognized parliament in Tobruk, the House of Representatives (HOR), and the cabinet of Prime Minister Abdullah al-Thani.

On the opposing side is Operation Dawn, a loose and increasingly fragmented coalition of militias from the powerful coastal town of Misrata, Islamist factions in Tripoli, and western mountain communities (including ethnic Berbers or Imazighen). The Dawn allies have rejected the legitimacy of the Tobruk parliament, convened their own unrecognized parliament, and installed their own prime minister, Omar al-Hassi.

A common labeling of the Dawn coalition and Misrata as the Islamist faction is mistaken: their key difference with Dignity is not over ideology but rather the inclusion of ex-regime officials into the new political order. Nevertheless, the Dawn forces have allied themselves militarily with Ansar al-Shari‘a and its Islamist militia coalition in Benghazi, with the Dawn’s prime minister al-Hassi telling a Western reporter that the Benghazi jihadist group is a “beautiful idea” whose excesses could be tempered through dialogue. Despite such talk, the alliance largely stems from a common enemy and is ultimately expedient—as are most alliances in Libya.

In essence, there are two separate but blurred theaters of conflict in Libya. In the east, there is an urban insurgency being waged by Islamist militias, some which have ties to al-Qa‘ida and now the Islamic State. In Tripoli and the west, there is a struggle for political power and resources by a diverse coalition of town- and regional-based factions that, unfortunately, has aligned itself with terrorists in the east. In a surprisingly nuanced statement, the Libyan foreign minister of the Tobruk government acknowledged this distinction, arguing that a military solution was not appropriate in the west. Regrettably, the admission appears to be somewhat of an outlier. The HOR passed a resolution declaring all of Dawn “terrorists” and Prime Minister al-Thani recently vowed to liberate Tripoli by force.

The costs to Libya since the start of Operation Dignity have been extraordinary. An escalating cycle of militia fighting, indiscriminate aerial bombings, and artillery duels has left more than 1,000 dead, caused nearly 400,000 external refugees and internally displaced persons, destroyed vital infrastructure like airports, caused oil exports to plummet, and spurred the exodus of foreign diplomats and businesses. Independent inquiries have found that both sides are guilty of using force against elected institutions, committing human rights abuses, and attacking civilian installations.

The challenge now for the United States is how to isolate the terrorist threat and tackle it in such a way to avoid exacerbating the civil war or further derailing the country’s democratic transition. A fundamental problem is that the United States and its allies lack a cohesive, credible counterterrorism partner on the ground, in terms of both capacity (the technical and military ability to deal with terrorism effectively and in a way that preserves human rights) and the appropriate will (the intent to go after only those groups deemed terrorists by the United States and not political opponents).

U.S. Counterterrorism Options

A survey of the counterterrorism options available to the United States shows the difficulty of overcoming these shortcomings:

Liaise with Libya’s Security Services and Police

This is the normal way that the United States deals with terrorist threats overseas—working discreetly with local security and police services to collect intelligence on and apprehend terrorist groups. In Libya, this is a severely limited option, most obviously because there is no U.S. Embassy presence to coordinate such activities.

The underlying obstacle, though, is one of partner capacity. In Benghazi, policing was handled by the Islamist militias, who were either unwilling or unable to stop the violence, or were complicit in it. The intelligence officers of the old regime were themselves the targets of this violence and have only recently reconstituted themselves in cities controlled by Dignity forces. In Tripoli, Islamist militias nominally under the Ministry of Interior took over the technical surveillance networks of the Qaddafi-era services. Liaison is further complicated by the absence of an equitable judicial structure under which terrorism suspects could be tried: Libya has no functioning courts, the militias run its prisons, and torture is widespread.

Build Up Libyan Counterterrorism Forces

Another option is to train and equip Libya’s military counterterrorism forces. Sometime in late 2012 or early 2013, U.S. Special Operations Forces began to do this. The focus of the program was the 800-strong 22nd Libyan Special Operations Forces (LSOF) Battalion, based at a military facility west of Tripoli known as “Camp 27” or “Camp Younis.” But the initiative collapsed this summer, and its demise holds a number of lessons for counterterrorism moving forward.

First, the training occurred in the context of a Libyan military that had an ill-defined command structure and a hollow institutional base; was rife with tribal, regional and factional rivalries; and whose overall strength paled in comparison to the better-armed militias.

Second, U.S. military officials have admitted that beyond imparting the technical skills to Libyan soldiers, they had little control over how or against whom the force would be used. This concern became apparent to me when I interviewed the Libyan commander of the 22nd LSOF in Tripoli in November 2013. According to him, the battalion was comprised primarily of Zintanis and other westerner tribes, to the exclusion of Misratans (the Zintanis’ longtime rivals) and easterners from Benghazi. In effect, the United States was creating yet another tribal and regional militia that would likely be used against political opponents and rival armed groups rather than U.S.-designated terrorists.

The training also exposed the difficulty of physical security and access in a country controlled by a complex mosaic of warring militias. The entire program ended this summer when the camp was raided twice by rival tribal militias, possibly with the collusion of Islamist figures who opposed the buildup of a force that would challenge the primacy of their own militias. Fortunately, U.S. trainers were not present when the camp was attacked, but the assailants made off with sensitive U.S. military equipment and an Islamist militia subsequently occupied the base.

Train Libyan Conventional Forces

Outside analysts often point to the training of a Libyan army as a silver bullet and a missed opportunity, one that if the United States and its Western allies had seized in late 2011 could have reversed the country’s decline and with it the growth of terrorism. This is mostly wishful thinking, especially in the wake of America’s hard-won lessons in building militaries in divided, post-conflict societies like Iraq, Afghanistan, and Mali. In Libya, these difficulties are compounded by the fact that the United States would have been starting from scratch: the Libyan army was largely defunct, hollowed out by years of neglect by Qaddafi and then by defections during the 2011 revolution.

Nevertheless, by early 2013, the Libyan government under then-Prime Minister Ali Zeidan devised a plan to train a roughly 20,000-strong conventional military known as a General Purpose Force (GPF). The United States, Britain, Turkey, and Italy each agreed to train a portion of this total at overseas bases.

From the outset, the GPF plan was doomed. The divided Libyan government was unable to define the force’s purpose, control, composition, and a mechanism for vetting its recruits. Zeidan’s political rivals disputed the legality of the initiative, accusing him of negotiating it without parliamentary approval or his military chief of staff. Islamists and some militias opposed the force as a threat to their dominance, with many demanding the enactment of a constitution that would formalize elected civilian control over the new army before they agreed to demobilize.

Operationally, many in Libya and the United States had doubts about the force’s applicability to Libya’s challenges. As its name implies, the GPF was meant to perform general military tasks, not the highly specialized work of counterterrorism or urban policing. It is unlikely that a six-month course of basic infantry skills and small-unit leadership would have created a force capable of cowing the country’s more powerful militias without parallel incentives for demobilization and disarmament and, more importantly, a political pact amongst Libya’s factions.

By early and mid-2014, the effort began to unravel. The U.S. training never got off the ground because the Libyan government never provided payment up front. Trainees in Turkey suffered what one U.S. official called “astronomical” attrition rates due to poor vetting. Those in Italy fared better due to stricter screening. But recruits who did complete the program returned to Libya to find that there was no military structure for them to join. Militias occupied military bases and armories, and staffing functions like payroll and logistics were largely nonexistent. Many were put on indefinite leave while others joined militias or Hifter’s forces. This fall, the British program fell apart when recruits at the U.K. training base were charged with sexual harassment of local women; the remaining trainees were sent home.

At the root of the collapse was the fragmented and contested nature of Libya’s security sector. Put simply, there is no cohesive, centrally controlled “army” to train.

Assist Hifter and Operation Dignity

Despite the divisions, some analysts have recently argued that the United States should abandon all pretense of neutrality and lend direct military support to Hifter’s forces and the Tobruk government more broadly. On the surface, there are merits to this line of reasoning. After all, as the U.S. Ambassador to Libya conceded in remarks this summer, the retired general is fighting a U.S.-declared terrorist group.

Hifter himself underscored this logic when I spoke to him in June at his fortified compound in eastern Libya. “We need Apaches, drones, and C-130s from America,” he said. “The old war was an intelligence war but now it is a military war because of Da‘ish [the Islamic State].” He went on to argue that because he was fighting America’s problem (terrorism), he was deserving of American assistance.

To be sure, Hifter claims control of a “Libyan National Army.” But the body is national in name only and should rightly be regarded as one militia among many. Hifter’s span of control over the army’s armed formations is more limited than is commonly assumed. An optimistic estimate by its spokesperson placed roughly 80 percent of its forces from “the official military.” Yet even these units are heavily penetrated by tribal and regional loyalties. The remaining Dignity allies are drawn from an assortment of federalist militias, “awakening” tribal forces like those guarding Birsis gate on Benghazi’s eastern approach, and Zintani brigades.

A more dangerous risk of direct support to Operation Dignity is its elastic definition of terrorism. Extending that label beyond Ansar al-Shari‘a to Islamist (and even non-Islamist) political factions in the west presents a dire risk to the U.N.-brokered peace talks America is backing and to Libya’s democratic institutions more broadly. Some of the Islamist factions in Dawn are unquestionably problematic for U.S. diplomacy because of their illiberal values and conduct during the conflict, but they do not meet the U.S. threshold as terrorists or a threat to U.S. interests.

For these reasons, the United States has wisely not provided security assistance to Hifter’s forces, despite its recognition of the HOR and the al-Thani government. More recently, the United States (and the United Kingdom) reportedly considered going even further, making Hifter a target of U.N. sanctions. But they faced resistance on this front from Russia and France.

Let Arab States Conduct Counterterrorism in Libya

Over the past two years, Libya has become a proxy battleground for regional states. This summer, Egypt and the United Arab Emirates (UAE) conducted airstrikes and special-operations raids against jihadist forces in Benghazi and Darnah and against Dawn militia positions in Tripoli. Increasingly, there are reports of Egypt providing military assistance and training to the Tobruk-based government.

The U.S. government maintains that such interference is unhelpful for a resolution of the conflict, with one official saying that it risks torpedoing the U.N. talks. Nonetheless, some observers have argued that the United States should lend greater assistance to the UAE and Egypt in the fight against terrorism in Libya by providing intelligence.

Such logic is misplaced for a number of reasons. First, U.S. objectives in Libya diverge significantly from those of the UAE and Egypt. As noted above, Egypt and the UAE are intervening in Libya with a far broader goal than the elimination of a terrorist threat: they want to undercut the influence of Islamist political factions and their affiliated militias whom they believe—wrongly in some cases—to be linked to the Muslim Brotherhood.

Second, the actual military effectiveness of their incursions has been limited and counterproductive. Airstrikes by themselves, as the United States is learning in its fight against the Islamic State, are a notoriously ineffective way to eliminate insurgent groups embedded in urban environments. The effect of the ground raids is less clear, although one Western diplomat noted that the Egyptian raid had produced “mixed results.”

Egyptian training assistance to the Libyan military is equally undesirable: a Libyan civil-military arrangement built on the Egyptian model and a police force trained to Egyptian standards is hardly a promising start for the country’s democratic transition.

When considering involvement by Libya’s neighbors, what should be remembered is that while the United States has made its share of counterinsurgency and counterterrorism mistakes, regional actors are often equally or far more capable of messing things up. Their excessively partisan and heavy-handed approaches can perpetuate the conflict and create new reservoirs of extremism.

Overwatch, Containment, and Direct Action

Given the risks of providing more direct backing to local actors in the counterterrorism fight, the best—or least bad—U.S. option in Libya is a strategy of overwatch (a persistent, focused effort of intelligence collection and diplomatic reporting), containment, and, when needed, limited military action.

Based on the Africa Command statement, it appears that the United States is devoting significant intelligence assets to monitoring the terrorist infrastructure in Libya. In the past two years, the United States has shown it has the capacity to intervene precisely and effectively: the seizure of Abu Anas al-Libi, a longtime al-Qa‘ida suspect, and Ahmed Abu Khattala, a suspect in the 2012 attack on the U.S. diplomatic outpost in Benghazi, are two known examples. Libya’s generally open terrain, long shoreline, and concentrated populated areas in the north enable access for direct military actions and make it difficult to conceal terrorist facilities.

The threshold for such an intervention should be high: the point before which Libyan camps become significant sources of training or logistical support for the Islamic State or al-Qa‘ida. Other triggers include an imminent plot against U.S. forces or interests, the presence of a senior Islamic State or al-Qa‘ida figure, or an opportunity to interdict the flow of funds, personnel, or materiel from the Islamic State into Libya (or vice-versa).

In the desert areas of the southern periphery, where elements of al-Qa‘ida in the Islamic Maghreb (AQIM) have set up logistical hubs, the United States should continue to coordinate its surveillance and operations with French military forces, which have reportedly conducted several strikes from bases in neighboring Sahelian states. In tandem, the United States should redouble its efforts to contain the terrorist threat through regional cooperation on border control, working closely through the European Union, which has set up a border-advisory mission.

This strategy does not imply passivity on the political front inside Libya. The United States should use diplomatic tools to actively shape the political environment to make it less conducive to the growth of the Islamic State and other radical actors. Support for the U.N.-sponsored talks on a ceasefire and an expansion of authority for the U.N. Support Mission in Libya (UNSMIL) are crucial steps for restoring security. The use of multilateral sanctions and designations is a way to persuade more pragmatic Dawn elements to abandon their support for Ansar al-Shari‘a and other rejectionists.

Already, there are indications this approach is taking effect: a recent appeal by the Misrata Municipal Council, a component of the Dawn coalition, for the dissolution of Ansar al-Shari‘a in Benghazi and in Darnah (they are separate entities) followed a formal blacklisting of the two groups by the U.N. Security Council. But the United States should also explore more creative ways to use Libya’s economic resources to compel the factions to come to the table, such as an asset freeze on the Central Bank of Libya and the National Oil Corporation.

Over the long term, the United States and its partners should restart their training of Libyan counterterrorism, police, and military forces once an inclusive national unity government is in place, with a clear roadmap for militia disarmament and demobilization that would include job creation and scholarships. They should work toward creating security forces that are representative of all of Libya’s tribes and regions and ensure that these forces are placed under the close control of an elected civilian government with broad representation.

Once diplomatic access is restored, the United States should strengthen its support for civil-society actors capable of pushing back against the terrorists’ narrative. It should bolster judicial reform to avoid incubating new strands of radicalism. And perhaps most importantly, it should encourage better governance, administration, and economic growth at the municipal level—crucial reforms in long-marginalized areas like Darnah and Benghazi where the Islamic State and other extremists have taken root.

***

Frederic Wehrey is a senior associate in the Middle East Program at the Carnegie Endowment for International Peace. A frequent visitor to Libya, he is the author most recently of “Ending Libya’s Civil War: Reconciling Politics, Rebuilding Security.” Follow him on Twitter at @FWehrey. He is grateful for the research assistance provided by Ala’ Alrababa’h, a junior fellow in Carnegie’s Middle East Program.