Libyans were due to celebrate last Tuesday — not Christmas Eve, of course, but the anniversary of their independence from British and French military rule in 1951. Tragically, the official festivities had to be cancelled, after Libya suffered its first suicide bomb attack last Sunday: Thirteen soldiers were killed at an army checkpoint 30 miles (48km) from the main eastern city of Benghazi.

This change in jihadist tactics will no doubt be seen by some as yet further confirmation that Libya is too chaotic to be helped. Yet, the opposite is true: It is a signal that the world can no longer afford to stand aside as this oil-rich nation of six million people appears to slide into chaos.

The soldiers killed outside Benghazi were part of an elite unit that has had some success in cracking down on extremist militias. The attack occurred now because the Libyan government and its supporters in the international community have an opportunity to start turning the tide against the armed militias that have progressively dominated the country since the overthrow of former president Muammar Gaddafi in 2011.

Admittedly, the economic and security situation in Libya has deteriorated significantly in 2013. Since the summer, protesters and later militias have occupied the country’s oil terminals and pipelines, slowing production to a trickle. Radical Islamists have begun a campaign of assassinations to destabilise the government and demoralise the official security forces.

Yet, the causes of the downward spiral in 2013 — weak government and lack of any real state infrastructure — also hide a strength: Libyans are finally free to express themselves and determine their own fate. Recently, in the wake of militia violence, ordinary Libyans have made clear that they want something better and are willing to act to secure it.

In November, for example, more than 70 unarmed civilian protesters were killed in violent clashes with militia forces in Tripoli and Benghazi; hundreds were wounded. This shocked the population and has galvanised anti-militia activism. Some powerful militias fled the capital of Tripoli.

Over the last month, the jihadist group Ansar Al Sharia — thought to be responsible for the killing of US Ambassador Christopher Stevens in 2012 — has been chased out of its headquarters in Benghazi, Derna and Ajdabiyya by civilian protesters. Government forces have also bested the group in limited clashes. The attack last Sunday was the jihadists’ response to seeing their support base dwindle and their freedom of movement squeezed.

At the same time, community leaders in eastern Libya are making serious efforts to negotiate an end to the oil blockade. So far, they have had no success, but support for Ebrahim Jadran — a blockade leader who has demanded autonomy for eastern Libya and a share of oil revenue for his group — has begun to waver. Protesters in Tobruk recently agreed to restart the flow of oil to the local refinery, out of frustration at Jadran’s inflexibility.

If a reinvigorated government can convince Libyans that it is building effective security forces, has a plan for economic development and is ready to begin an effective national political dialogue, it may be able to reverse the vicious circle in which Libya has become trapped.

There are three prerequisites for change. First, the government must set an immutable calendar for the remainder of the transitional period. Last Monday, the General National Congress voted to extend its mandate by a year to oversee the writing of the constitution and conduct new elections. This step is likely to provoke a popular backlash if a precise timetable, and a set of benchmarks against which progress can be impartially measured, are swiftly promulgated. The measure must include a plan to restart the stalled national political dialogue, building on some inspiring small-scale initiatives by nongovernment organisations and civil society groups in cities across Libya.

It cannot be said too often that Libya will be forced to build state institutions from a scratch, unlike other Arab Spring countries. There needs to be a modicum of consensus about what that state should look like to galvanise popular support for the transition process, including the drafting of a new constitution.

Second, a renewed effort must be made to disarm and demobilise the militias, which have filled the political vacuum since Gaddafi’s fall. Many militias are paid by the government, but answer only to their commanders. The government should stick to its aim of withholding salaries of militiamen who continue to carry weapons, but do not enlist in the regular security forces by the deadline of December 31. It should also establish a process, with international help, to collect weapons.

Third, the government should coordinate more closely with municipal councils, providing them with more funding and decision-making power for local projects. Many of these local councils have proved effective and are the closest to the needs and aspirations of ordinary Libyans. This agenda is daunting and the government has few tools to implement it, making international support and engagement essential. International organisations and bilateral donors have been providing expert assistance in Libya, but not enough. Some countries that played a direct role in 2011 are now standing on the sidelines.

There is no appetite among Libyans for foreign peacekeepers, but there needs to be a more visible and substantive multilateral commitment to Libya. A stable Libya has the potential to spur economic development throughout North Africa and the Sahel region and reduce migration flows to Europe. If state-building fails, by contrast, the country can act as an agent for instability and violence throughout the region, as became clear last year in Mali.

The US, in particular, needs to transcend its “Benghazi syndrome,” moving beyond domestic political squabbles about whom to blame for the tragic death of Ambassador Stevens and formulate a coherent policy towards Libya.

The new US Ambassador, Deborah Jones, is well-qualified and keen to act, but she needs more support and a clear mandate from Washington. The North Atlantic Treaty Organisation and the African Union — or even private-sector contractors — can help by passing on expertise derived from the demobilisation of militias elsewhere and overseeing the collection and disposal of weapons. Once a national political dialogue is under way, the United Nations should appoint a high-profile international envoy to ease both the reconciliation and capacity-building processes.

Improving security remains essential, but Libya’s problems cannot be solved by military means alone. Nothing will create greater optimism than a coordinated plan for economic and infrastructure development in Libya’s largest cities — an area where foreign governments and companies can provide much-needed expertise.

The challenges in Libya remain formidable and some political groups, militias and others with vested interests will continue to impede progress. Yet, the recent upsurge of public outrage at militia violence provides a real mandate for the Libyan government — together with local councils, civil society and the international community — to act.

— Washington Post

Richard Northern was British ambassador to Libya from 2010 to 2011. He is now the director of RN4 Consultancy. Jason Pack is a researcher at Cambridge University and editor of The 2011 Libyan Uprisings and the Struggle for the Post-Qaddafi Future.