Libya faces grave security challenges as it cobbles together a new government. Reuters

Gunmen in Benghazi, Libya’s second city, have assassinated a top security official who was instrumental in the government’s uphill battle to rein in local militias.

Security Director Faraj Mohammed al-Dursi was shot dead as he returned home from work on Tuesday evening. Three men in a car pulled up near his house, got out to open fire on the official, and then sped away. No group has yet claimed responsibility for the killing.

Dursi had been appointed only weeks earlier to clamp down on extremist groups like the one that killed four American diplomats, including U.S. Ambassador Christopher Stevens, in Benghazi this September.

In Libya, various militias have taken domestic security into their own hands following the 2011 revolution that overthrew former dictator Moammar Gadhafi. Having been at the forefront of the movement to oust the regime, the groups are loath to relinquish what they see as their rightful local sovereignty.

The country’s new government in Tripoli is essentially unable to establish an effective security apparatus of its own. In many ways, it relies on local militias to establish order where it cannot. But those groups – many of which are headed up by Islamist militants – have become a serious threat to Libya’s stability.

Dursi is the 18th official to be assassinated in recent months, according to the Libyan newspaper Tripoli Post. Many of those killed were targeted for their links to the Gadhafi regime. Dursi had been a member of the former dictator’s cabinet, though he defected to join the revolution shortly after it began.

This will be another tragic setback for Libya’s embattled central government, which is still struggling to cobble itself together and establish peace between the country’s many divided factions.

But Libya has made some progress since its bloody revolution.

National elections were held to select a parliament – called the General National Congress,or GNC – in July. Two main blocs dominate the body: a liberal secular coalition and an Islamist party supported by the Muslim Brotherhood.

Then came the GNC’s generally well-received selection of a new prime minister, Ali Zidan, in October. (This followed the failed appointment of another prime minister in September). Zidan has since appointed a new cabinet, which was approved last month. The prime minister has pledged to keep both secularists and Islamists in mind as he guides the country through its rocky transition to a fully functional – and secure – democracy.