Two years ago this month, Tripoli, the capital of Libya, fell to the amalgam of rebel forces that had been closing in on the city. The country’s leader Muammar Qaddafi fled to his home town, Surt, where, on October 20, 2011, rebels stabbed, beat, and shot him to death after his convoy was hit by a NATO missile strike. Qaddafi’s eccentric, forty-two-year dictatorship was over, signalling the apparent end to a dramatic chain of events that had started nine months earlier, in the eastern city of Benghazi. There, inspired by the overthrow of Hosni Mubarak, in neighboring Egypt, Libyans had demonstrated against Qaddafi’s rule, and the protests had turned into a bloody national showdown with security forces. The protesters, eventually assisted by French, American, and British bombers under the NATO banner, succeeded. The smoke had not yet cleared when the victory was being touted as a shining example of what Western powers could do on a modern battleground without ever putting “boots on the ground.”

With no further need for war and with Western powers fussing over what was being vaunted as the oil-rich nation’s new democracy, Libya should have once again achieved peace and stability. Instead, the country, of more than six million people, seems to have been fatally destabilized by the war to remove its dictator, and it is increasingly out of control. Militias that arose on various regional battlefronts found themselves in possession of vast arsenals and large swaths of territory. Despite the orchestration of parliamentary elections and the assumption of nominal rule by civilian politicians in Tripoli, those militias have not stood down; instead, they have used their force and their firepower to try to effect change in the capital, even, on several occasions, besieging government buildings. They have also fought one another over long-held regional enmities; the most recent such battle occurred last month.

The current Prime Minister, a lawyer named Ali Zeidan, has defended his government’s powerlessness, saying that its failures derive from the weakness of Libya as a state. There is a great deal of truth to that: assembled from three ancient Ottoman wilayats, the modern state of Libya was only eighteen years old when Qaddafi seized power from the country’s monarchy, in 1969. In his absence, Libya’s nationhood is like a garment worn thin. As the Libyan author Hisham Matar wrote last week, “Under Gaddafi we were afraid of the state; now its weakness imperils all we have achieved. “

The degree to which Libya is out of control became apparent on September 11, 2012, when a large mob, which included extremists both inspired by and affiliated with Al Qaeda, attacked a U.S. diplomatic compound in Benghazi, killing the visiting U.S. Ambassador to Libya, Christopher Stevens, and with three others. The incident did not set off a debate about what to do in Libya but, rather, incited an almost entirely America-centric one, characterized by politically motivated finger-pointing about U.S. command-and-control weaknesses and errors. Meanwhile, the NATO-facilitated situation on the ground in Libya has worsened, with extremists operating with increasing impunity.

In June and July, dozens of Libyans were killed in separate clashes between militias in Benghazi and Tripoli. The past week or so has been particularly bad. On Friday, July 26th, a prominent lawyer in Benghazi, Abdelsalam al-Mismari, was shotkilled as he left a mosque after Friday prayers. Mismari was a prominent leader of the 2011 rebellion against Qaddafi, and, more recently, he had emerged as a vocal opponent of the country’s second-largest political group, the Justice and Construction Party, a conservative faction allied with the Muslim Brotherhood. The suspicion is that extremists assassinated him. Two security officials were also killed in the city that day. Then, on July 27th, more than a thousand inmates broke out of a prison outside Benghazi, in still murky circumstances. (This mass jailbreak coincided with others, linked to Al Qaeda, in Baghdad, and to the Taliban, in Pakistan.)

The following evening, just before anti-Islamist demonstrations against the outburst of violence were due to start, bombs exploded outside the iconic waterfront Benghazi courthouse, where the Libyan rebellion began. Suliman Ali Zway, who reports from Libya for the Times, e-mailed me that day to say that he had never seen the situation so bad. Later, he sent me a P.S.: he had just been carjacked by armed militiamen. He had lost his car but felt lucky to have escaped with his life.

The regional dimensions of the Libya mess have not been accurately calculated by the policymakers who urged on the rebellion, but they appear to be huge. Following the fall of Qaddafi, well-armed Tuareg militiamen from Mali who had served him for years as mercenaries fled home in their battle wagons, and soon thereafter lent their weight to secessionist aspirations in the remote Northlands. (I wrote about the situation in Mali for the magazine last month.) The Mali episode showed—not for the first time—how a few determined and well-trained men with guns can do a lot of harm in remote areas of poor countries.

Libya lacks the ability to police its borders, not to mention its armories, and Al Qaeda thrives in any vacuum of influence. The bloody hostage crisis at the oil field in southern Algeria, in January, was linked to French intervention in Mali; in April, the French Embassy in Tripoli was bombed; and in May, in Niger (another weak state that shares a border with Libya), bombers killed nearly thirty people. This year, two prominent secular politicians have been assassinated in Tunisia, where the Arab Spring began. In a separate incident last week, terrorists apparently operating from the Algerian border killed eight Tunisian soldiers. On Tuesday, tens of thousands of Tunisians took to the streets of Tunis to demand the resignation of the governing Islamists. With post-Mubarak and, now, post-Morsi Egypt under increasingly assertive military control, the Arab Spring appears to have been replaced by spreading chaos.

Syria is the black hole in this firmament, sucking what light is left into its civil war. The NATO allies who rained missiles on Libya have fallen into a queasy silence on the subject of Syria—just as they are absent on the ground as guarantors of the peaceful restoration of the state of Libya.

On Tuesday, news came that the Justice Department had charged a Libyan militia leader in Benghazi, Ahmed Abu Khattala, with complicity in the attacks that killed Ambassador Stevens. Abu Khattala, who has acknowledged being at the compound that night but denies any responsibility for Stevens’s death, has openly mocked the U.S.’s attempts to hold him accountable for the murders. In Benghazi on Wednesday, Suliman Ali Zway tweeted, “I met Abukhattala twice, and I’m very familiar with the Benghazi military dynamics/environment; good luck getting any1 to arrest him.”

Photograph by Diana Matar. See more of Matar’s photographs of Libya.