Armed militias were once the salvation of Libya. Today, they are what stands in Libya's way. In Benghazi, where I recently returned, a large demonstration gathered last weekend to demand the demobilisation and the reintegration of these combatants into the state.
At the very least, the public wanted them to put down their arms and leave. Amazingly, two militias did both.
But what if these groups hadn't left so easily, abandoning their posts in the face of public pressure? Libya's new government does not have the ability to enforce its will, but the street can't do the government's work forever.
During the war to topple Muammar Qaddafi, I headed up teams of about 70 young Libyan men and women who resided and operated in most continents of the globe, utilising modern technology - from social networks to satellite communication systems - to unify the country.
Our aim was two-fold: to convince the international community of Libyans' commitment to a democratic future, and to prepare plans for stabilisation and reconstruction when the war was won. On most fronts we've had remarkable progress. But on the issue of security the challenges remain great.
At the weekend 11 people were killed and scores wounded during the violence in Benghazi, a public show of force that ultimately pushed some militias to vacate. We still don't know exactly how it transpired or how this uprising unfolded. An investigation is needed to sift through the details. The city is traumatised again, and will remain so for some time.
Recent moves by the military command to rein in armed militias have restored a semblance of order, for now. But ensuring that this lull in violence is lasting will take more than orders from Tripoli.
The first step in the reintegration process - and the first step in restoring the government's mandate - is determining who was behind the attack on the US consulate this month, killing four Americans, including a personal friend, US Ambassador Chris Stevens, and their Libyan defenders. Was this strike a pre-planned Al Qaeda-linked attack? Or was it a violent reaction by a group of individuals, perhaps remnant elements of the former regime, acting on their own? Police work is now required to identify the culprits.
But closure on this case alone will not improve security in Libya. The response of the Libyan government, when the new cabinet is announced by the end of the month, will have to be very clear and decisive to deal with the criminal aspect of post-Qaddafi Libya.
Moreover, the incoming interior minister will be facing an issue that seems to be a police matter but has many political implications as well. Strengthening the defence and interior ministries, bulking up police and army ranks and finding jobs for those with guns and no place to be - these will be Libya's challenges. To address them, the cooperation of all parties, including the friends of Libya everywhere, will be needed.
Imaginative proposals to demobilise the militias and to reintegrate some of their members into the army and the police will have to be put into effect promptly. One idea whose time has come is the establishment of a new force for Libya, akin to a national guard, that employs former militia men in a bid to augment the nascent army and police forces.
Libya is undergoing a nation-building project through a democratic and peaceful process of expanding freedoms. And we have made progress. Our economy is rebounding, politics is representative, and we have a budding vocal media. Yet many unanswered questions remain.
Are we in for a protracted war among different sets of values? Are we facing new instigators of violence? Are we facing a problem that is difficult to resolve internationally because of "double standards" in the way we view different values? How can we reinvent our police work on the international level to deal with the issue of security pre-emptively? These and many other issues are going to play out as Libyans reinvent their lives and state within a peaceful context.
The stakes are very high, and the lessons from the recent violence in eastern Libya must be learnt quickly by all parties. These incidents have cast an ugly shadow over the Libyan reconstruction project, affected the US presidential campaign and, many would argue, redefined how the struggle inside Syria is viewed by the international community. International intervention in Syria is no longer feasible, in part because of the challenges such action presented for Libya.
All of these concerns will be trivial, however, if the government in Tripoli does not figure out a way to do what Libyans did themselves at the weekend: enforce their will over tyrants with guns.
Ahmed Jehani, a visiting scholar at the Carnegie Middle East Center, was Minister of Reconstruction for the National Transitional Council of Libya