The Libyan uprising that ended Colonel Muammar Qaddafi’s forty-year dictatorship had the making of a fairytale. Civilians fought for their liberties, the international community came to their rescue, and justice was done. A regime based on terror ended, and everyone lived happily ever after.

In reality, however, the Libyan case has turned into a grim saga of unchecked violence and nonexistent transitional justice, moving toward even more instability both for the country itself and for its neighbors in Africa and Europe. Yet none of this gets noticed by the international media, which prefer to focus their attention on Syria.

A failed Libya would discredit NATO’s Operation Unified Protector of 2011. The international community cannot afford to bring down a violent regime only to replace it with chaos. The lack of security in Libya facilitates terrorism and puts Europe’s energy supplies at risk. Oil installations in Libya’s central regions have become vulnerable targets.

The main problem is that the Libya that emerged after the NATO intervention one and a half years ago had no security structures to speak of. What remained of police stations was burned down by angry civilians. With few exceptions, the military had also melted away.

Nevertheless, the National Transitional Council, a self-appointed body of notables, rejected even a small UN military observer mission. Libya did “not need outside help to maintain security,” the Council declared right after Tripoli fell to the rebels.

Instead, the many militias that had emerged during the conflict and that continued to proliferate afterward were provisionally put in charge of security, while police and military forces were to be rebuilt as fast as possible. Both parts of this plan turned out to be fatally flawed.

Although the militias did indeed manage security, they did so according to their own rules. That included the temporary occupation of Tripoli airport, the establishment of arbitrary detention centers, and the random execution of former regime members, especially in eastern Libya. Most prominently, one militia based in the northwestern town of Zintan is currently holding Qaddafi’s son Seif al-Islam while he awaits trial.

The longer the militias reigned over Libyan security, the more directly they interfered in politics. In October 2012, they even stormed the building of the General National Congress, the transitional Libyan parliament that was elected last June. The militias’ newly acquired power culminated in a siege of several ministries this week. They forced the resignation of five ministers, including the foreign and defense ministers, and the adoption of the Political Isolation Law, which bans anyone who was active under the previous regime from politics for ten years. The militiamen have also called on the prime minister to resign and for their own leaders to be given government posts.

Libya’s citizens are unhappy with this blessing-turned-curse. Protests against militia rule began as early as December 2011 and continued throughout last week.

But demobilizing and reintegrating the fighters is proving more difficult than expected. The Warrior Affairs Commission, nominally in charge of managing the transition back into civilian life, has registered 250,000 veterans, many of whom seek employment in the Interior or Defense Ministries. Only 6,000 have asked to be integrated into the new armed forces.

The militias’ top commander until this week, General Yousef al-Mangoush (also a political casualty of militia rule), was not keen to integrate more than this number because he wanted to keep his military lean and professional. Most militiamen, however, do not wish to disarm or demobilize anyway. Their newly found, unchecked power cannot be matched by anything the new Libyan state can offer.

Meanwhile, the lack of security has resulted in a number of serious incidents. There have been attacks on the Red Cross offices in Benghazi and Tripoli, the Tunisian consulate, the British ambassador’s convoy, the French embassy, and the U.S. consulate in Benghazi—all of which are signs of a deteriorating security situation flanked by rising organized crime.

Libya’s neighbors are concerned about the combination of easily available weapons and the country’s long and now unguarded borders. The terrorist attack on the Algerian oil facility of In Amenas in January, which led to the death of 38 civilians (including sixteen Westerners), is believed to have been carried out with weapons from Libya. The terrorists themselves probably entered Algeria from Libya as well.

Establishing proper security forces is taking all the more time as the process has had to start from scratch. In contrast with Iraq, Libya’s armed forces under Qaddafi had been weakened to the point where they were militarily useless. Recruitment of young officers ceased years ago, as did promotion beyond the rank of colonel.

Libya’s security therefore has to be rebuilt from nothing. The many cooperation programs the government has embarked on with friendly states are too slow and too limited in scope to build up security as fast as Libya needs. European states need to step up both the speed and breadth of their cooperation if they want to prevent the Libyan fairytale from turning into a nightmare.