There has been no shortage of attention paid to the 2012 terrorist attack on the U.S. compound in Benghazi. Most of the questions, however, have centered on the shortcomings in Washington’s response to the crisis, rather than the causes and effects of the Benghazi attack itself. A closer look at Islamist politics in Libya reveals that this singular event was part of a larger plan to create an Islamic State within Libya after the fall of former leader Muammar al Qaddafi.

In fact, over the span of a few years, Libya turned from one of North Africa’s least radicalized countries into a global Islamist hub. Benghazi may have been a flash point in the story of Libya’s unraveling, but it is one event among many that has forever altered the country’s trajectory. To understand what led to the siege on the U.S. installation in Benghazi, one must look back to Washington’s rapprochement with Qaddafi.

The U.S. invasion of Iraq in 2003 coincided with a process of Western rapprochement with Libya, opening the oil-rich country to foreign business. Crippling UN sanctions, prompted by Qaddafi’s 1988 bombing of Pan Am flight 103 over Lockerbie, Scotland, had already been suspended by 1999 after Qaddafi agreed to hand over two suspects for trial in The Hague. The U.S. State Department would have been content to see Qaddafi’s regime stew in sanctions indefinitely, but his readmission into the international community seemed inevitable. And so, the administration of President George W. Bush saw an opportunity to press Qaddafi, bolstering a narrative that the U.S. intervention in Iraq could help topple other rogue states. The administration could pressure Qaddafi to abandon his incipient nuclear and chemical weapons programs, and to compensate the families of the Pan Am 103 victims. The United States set up a diplomatic outpost in Libya in 2004, the same year that the EU arms embargo was lifted.

Although contentious within Washington (and the State Department in particular), the deal with Libya was attractive for another reason: It offered the prospect of access to Qaddafi’s intelligence on regional radical groups. In particular, it could provide information on al Qaeda. Libya had an odd but important role in the growth of al Qaeda: A small but growing number of Libyan youths were attracted to al Qaeda leader Osama bin Laden’s calls for jihad in Afghanistan, and many used their experience with the organization as a means of gaining experience to eventually wage war against Qaddafi. Libyan al Qaeda members were fiercely pursued at home, barring their return to the country. Therefore, many became lieutenants for bin Laden, and used the organization to incubate a new group, the Libyan Islamic Fighting Group (LIFG), which shared leaders and attempted to grow cells within Libya itself.

The agreement also made Qaddafi see an opening for intelligence collaboration: From 2003 to 2005, the CIA and British intelligence managed to track down more than 30 of Libya’s most-wanted fighters, many of whom were in Afghanistan, and delivered them back to Libya for interrogation (and undoubtedly, torture) as part of the Bush-era extraordinary rendition program. Included were much of LIFG’s leadership, including its former head, Abdelhakim Belhadj, who would become an influential power broker in post-revolution Libya.

The United States and the United Kingdom helped Qaddafi orchestrate an extensive, multi-year political makeover, fronted by Qaddafi’s son, Saif al Islam. Critically, this makeover included reconciliation with some of the same regime opponents the United States had rendered back to Libya, as well as with the Muslim Brotherhood. The Muslim Brotherhood is the region’s largest Islamist group. Founded by Hassan Al Banna in Egypt in 1928, it established a branch in Libya in 1949. But in part due to Qaddafi’s vigilance, the group never developed a major presence in Libya, as it had in Egypt and Tunisia. The Brotherhood has been widely seen as moderate, but questions about the organization’s connections to radical and terrorist organizations have grown, as evidenced by a recent study commissioned by the UK government.

According to a new biography of Saif by Mohammed Al Houni, his advisor during the era of Western rapprochement, senior Qatari officials convinced Saif that involving the offices of the Muslim Brotherhood outside of Libya to secure a truce with the LIFG (and the Brotherhood itself) would be essential to Libya’s stability as it opened itself to the West.

Libyan leader Muammar Gaddafi's most prominent son, Saif al-Islam, pauses during an interview with Reuters in Tripoli March 10, 2011. Chris Helgren / Reuters

Saif thus called on Ali Sallabi, a prominent Libyan Muslim Brotherhood member living in Qatar, to negotiate a deal between the senior LIFG members, who were back in Libya. According to this deal, LIFG leaders would be released if they agreed to public renouncement of violence against the regime. The agreement was signed (to the objection of other LIFG members and al Qaeda abroad), and Saif delivered a speech in March of 2010 announcing the release of prisoners. Many in Qaddafi’s inner circle opposed this move, and questioned the sincerity of the LIFG members’ conversion, but they were overruled. U.S.–Libyan relations started to go downhill rapidly thereafter due to Qaddafi’s erratic maneuvers, including a 90-minute rant at the United Nations, talk of re-nationalizing Libya’s oil industry, and threats the leader made against U.S. diplomats in Tripoli.

It was within this context that the Libyan revolution occurred, as part of the larger Arab Spring. There were Islamists in this mix, but they did not lead the revolution. They did, however, stand to benefit from it disproportionately. Forty-two years of misrule had gutted Libya’s institutions, making the country highly susceptible to chaos that facilitated a takeover. Foreign fighters flooded into Libya from neighboring states, seeking refuge and a base for expansion. Libyan Islamists were more organized than the multi-faceted and fractious progressive groups within the country. They were also were heavily supported by the Muslim Brotherhood, al Qaeda, and outside states.

Perhaps most importantly, Libyan Islamist groups benefitted from a vague and growing consensus in Washington that moderate political Islam, as represented by the Muslim Brotherhood and Turkey’s division between mosque and state, might be the answer to many of its problems in the Middle East. This counterintuitive view was underpinned by Washington think tank studies and op-eds by former U.S. officials, including former Secretary of State Condoleeza Rice, who suggested the time had come to hear out the Muslim Brotherhood. It also dovetailed with evolving doctrine of leading from behind—wherein Washington would promote a cooperative local proxy that would support U.S. objectives while obviating the need for greater intervention and expenditure—at a time when the Obama administration was trying to disengage militarily from the region. The Muslim Brotherhood’s victory in Egypt’s 2012 elections seemed to convince Washington of political Islam’s inevitability, and led many to feel it was better to side with supposed moderates.

What planners in Washington failed to take into account, however, was that Libya was not Egypt or Turkey. They gravely overestimated the appeal of radical Islam in Libya, a young but socially conservative and observant society with an important Sufi past (Sufism is anathema to Islamists). Therefore, the United States did little to enable the Libyan majority to assert itself in the face of a rapidly forming Islamist plan to take over the country. Making matters worse was the fact that self-proclaimed moderate Islamists would say very different things to different constituencies. Foreign diplomats were thus taken aback when progressive Libyan groups, as represented by Mahmoud Jibril’s National Forces Alliance, dominated the elections in 2012 and 2014.

A rebel soldier gestures atop a car as he heads to Brega, in Ajdabiya March 2, 2011. Goran Tomasevic / Reuters

IN THE AFTERMATH OF INTERVENTION

In many ways, the U.S. intervention in Libya was a heroic decision—a substantial political risk taken on principle at a time when doing nothing was an obviously safer option. Several years later, however, the decision to intervene on behalf of the rebels has come to be seen as the original sin that led to Libya’s status as both a failed state and a base for ISIS. But the intervention did not cause the resulting disaster. Rather, it was heavily conditioned by what the West had done in years prior—including the return of extremists to Libya, the passive agreement to lifting arms embargos on the Qaddafi regime, and support for the rapprochement between Qaddafi and Libyan radicals.

In the immediate aftermath of the revolution, Qatar and Turkey committed resources to keep Libya’s nascent government alive. And for that, most Libyans were supremely grateful. Their appreciation eroded, however, when it appeared that both countries supported Islamists instead of the country’s future. Qatar sent nearly 20 tons of military supplies to help liberate Tripoli. And when these goods arrived in Benghazi, they were diverted from the interim Transitional National Council and its moderate leaders, to members of the Muslim Brotherhood and put under the control of Belhaj, the former Libyan Islamic Fighting Group emir.

THE LIBYAN REVOLUTION HIJACKED

Once the initial uprising and foreign intervention ended, Libya’s Islamists (as well as many external groups) set out to thwart the country’s new leaders. The nascent government’s hasty relocation to Tripoli left Benghazi exposed. Within months, the city saw a rising tide of anonymous assassinations of security officials, military intelligence, civil society activists, intellectuals, and journalists—anyone who might interfere with an Islamist takeover. The murder of rebel military commander Abdelfatah Younes in July 2011 should have been a clear red flag: Younes had been Qaddafi’s anti-Islamist enforcer, and was seen by many Islamists as the biggest threat to an Islamist takeover.

Before the U.S. compound attack, Benghazi was a livable city, despite the number of weapons in the hands of its citizens. Civic pride was high, garbage was being collected, and there was relatively little violent crime. In May of 2012, the city even elected its first female mayor, who was also the single largest vote-getter. This period of calm would prove to be the last chance the international community had at training security forces, strengthening medical infrastructure, and rebuilding the city, as a bulwark of Libya’s fragile democracy. Benghazi’s security situation began to collapse by early June—almost a year and a half after the revolution. The city bore witness to numerous attacks on high-profile local and foreign figures, including several ambassadors. The attack on the U.S. compound was but the culminating act of violence in the city. What followed was the destruction of the Libyan nation-state, and the resurrection of factional fighting throughout the country.

A member of the Libyan pro-government forces, backed by the locals, holds his weapon as he looks through a hole in a wall, during clashes with the Shura Council of Libyan Revolutionaries, in Benghazi January 21, 2015. Esam Omran Al-Fetori / Reuters

Following a second national electoral loss in 2014 and the formation of an anti-Islamist front, Libya’s Islamists determined it was time to change tactics. They split from the internationally recognized government to form a competing government based in Tripoli, made up of a mixture of Islamists and non-Islamist militias from the coastal city of Misrata. Under the appropriated name of the previous government, the General National Congress (GNC), the group has pushed the elected government back to the country’s east in what could best be described as a partial coup. As a result, Libya is now divided—Islamists exercise influence in Tripoli, and the internationally recognized government works out of Tobruk. The United Nations has tried to cajole both sides into forming a Government of National Accord, for which there is some hope, but many obstacles. The more the United Nations pressed for peace, the more Tripoli pressed for concessions—even threatening to open the floodgates for Libyan migrants toward Europe. All the while, the militias associated with the government in Tripoli have been shuttling fighters to the frontlines of Syria to fight the Assad regime. There is strong reason to suspect that these flights are moving ISIS fighters back to Libya as well.

At the start of the UN-mediated reconciliation process in late 2014, ISIS had but a thin presence, consisting mostly of a group of self-proclaimed affiliates in the coastal town of Derna. By the close of talks in 2015, ISIS had taken advantage of the political vacuum and strategic alliances with Islamists, to relocate to Qaddafi’s hometown of Sirte, and spread both east and west. Its numbers have grown to 4,000–6,000 fighters, according to various estimates, and perhaps many more. The group maintains camps in the west of the country, from which it has launched a series of deadly attacks on Tunisia. It has also taken aim at Libya’s oil infrastructure.

BACK TO BENGHAZI

Back in the United States, many inside the beltway continued to see the Benghazi attack as an isolated event. The true motive behind the siege, however, was to push Washington and the West out of Libya. The orchestrators of the attack used its ambiguous nature and the chaos of the day as a weapon: The true agents behind the Benghazi siege are still not completely known, and the hyper-partisan environment in Washington has only furthered the confusion over the attack’s broader meaning. Both Democrats and Republicans ignored signs that Benghazi could devolve into chaos. In off-the-record conversations after his tour as U.S. envoy to Benghazi, and before his confirmation as ambassador, U.S. Ambassador to Libya J. Christopher Stevens expressed to me this precise fear that that Benghazi’s devolution into chaos would take down Libya as a whole.

During the first Democratic primary debate, former Secretary of State Hillary Clinton said she believed that U.S. President Barack Obama had made the right decision when Washington chose to intervene in Libya, and that the United States had helped moderates win the first free elections in Libya since its independence in 1951. Despite a large body of literature arguing otherwise, both assertions are resoundingly true. The real question, however, is what happened to the moderates that had support from the United States and the Libyan electorate. The Benghazi attack should have sent a clear message that Libyan politics were about to collapse. The fact that it didn’t underscores the strategic brilliance of the Benghazi attack: The attackers created enough chaos to leave all sides pointing the finger at one another, freeing the true culprits to exert their power elsewhere. The West’s gross failures in Libya lay in not conditioning military support during the revolution upon active cooperation with the West post-revolution, not providing substantial reconstruction and disarmament assistance, and grossly overestimating how much outside power the Islamist groups had available to them.

And despite what years of rancor in Congress may have demonstrated, neither Democrats nor Republicans are uniquely to blame for the Benghazi attacks, nor is either party responsible for Libya’s collapse. Both parties contributed to the discord that followed in its wake at different times.

The imperative now, as it has been for some time, is to correctly diagnose the problem, and face complicated facts about Benghazi: Without this, we are doomed to repeat the same policies that will inevitably enable ISIS to spread in Africa. Algeria, Morocco, and Tunisia face the same threats to stability that Libya experiences today. If Libya falls to Islamist rule, much of North Africa will likely follow. And if the past is any indication, moderates will not determine these nations’ futures either.