To Western observers, the death of US Ambassador Christopher Stevens and three other embassy officials in a rocket attack in the eastern city of Benghazi on Sept. 12, 2012 was the first disturbing sign that something was seriously wrong with the post-Gaddafi dispensation in Libya. Since then, things have only gotten worse as shown by the brief kidnapping last month of Prime Minister Ali Zaidan in what many thought was an attempted coup. More than 45 people were killed in Tripoli last Friday after gunmen from one militia opened fire on protesters marching on their base to demand they leave the capital city. People's anger was such that militias from a string of Libyan cities had to leave Tripoli after surrendering their bases to the army. It is too early to decide whether Thursday's withdrawal is a triumph for the residents of Tripoli. There are questions about whether this is in earnest or just for show. The developments in the last two years have not been very reassuring. Many of the militias have long rejected government calls to lay down their arms or integrate into the armed forces, triggering the frustration of Libyans who find themselves caught between a weak central government and powerful militias. The militias vastly exceed the army and police forces in size and arsenals. To make matters worse, they have often been approached by the government to bolster its own security needs because the army and police are so weak and ineffective. The divisions within the government (for example, the secular National Forces Alliance's standoff with a wing of the Islamist Muslim Brotherhood over the country's transition to democracy) also play into the hands of the militias. So what went wrong? Some kind of instability and anarchy is inevitable after the overthrow of a dictator who ruled a country with an iron hand. But this alone does not explain the chaos engulfing Libya. A series of missteps by local leaders and foreign powers, or perhaps a bit of both, are responsible for the post-Gaddafi tumult. One example: Mass executions were carried out by the rebel groups on the day of Gaddafi's death. Though the identity of the groups involved was known, no action was taken. No wonder, some of the militias thought they were above the law. The rebel groups fighting Gaddafi looked to Western backers for weapons and money. This created the impression that some of the government ministers were acting at the behest of their foreign backers. In short, the new leaders failed in their primary task of developing Libya into a secure and functioning state commanding the allegiance of all its' people. But it is not too late. Despite the recent violence, people are not cowed down. Hundreds of university students on Tuesday marched in Tripoli, chanting against the militias and demanding that the army and police assert themselves. One of the biggest changes over the last year is that oil production has recovered. According to reports, Libya's oil revenue is roughly $1 billion every ten days, something that would go far in a country of around 6.5 million. Now Libya needs a reconciliation commission on the lines of South Africa to unify its tribal, regional and ideological factions. The most important is the strengthening of its security forces, integrating the rival militias if possible. Democracy can survive and thrive only in an atmosphere of stability and calm.