The assassination in Benghazi of the American ambassador to Libya is an appalling act – and one foreseen by his employers. On 27 August, the state department warned US citizens against all but essential travel to Libya, painting a picture of a country beset by increasing instability and fraught with danger.

"The incidence of violent crime, especially carjacking and robbery, has become a serious problem… Political violence, including car bombings in Tripoli and assassinations of military officers and alleged former regime officials in Benghazi, has increased. Inter-militia conflict can erupt at any time or any place in the country," the state department said.

Exactly who is responsible for the death of Christopher Stevens and three embassy staff is unclear. Libyan officials blamed pro-Gaddafi loyalists linked to the bombings in Tripoli. Salafists, ultra-conservative Muslims who besieged the Benghazi consulate overnight, seem to be the more likely culprits. They have mounted a string of recent attacks on Sufi shrines and are said to have been enraged by clips of a film on the internet that defames the prophet Muhammad.

Any number of other Libyan armed groups might have had a hand in the killings. But in truth, responsibility may also be traced back, directly or indirectly, to those in London, Paris, Brussels and Washington who launched last year's Nato intervention in Libya with insouciant disregard for the consequences. It was clear then, or should have been, that toppling Muammar Gaddafi was the easy bit. Preventing an Iraq-style implosion, or some form of Afghan anarchy, would be much harder.

Yet this is exactly what Stevens's death may presage. Once again, the western powers have started a fire they cannot extinguish. A year after David Cameron and Nicolas Sarkozy jointly travelled to Libya to lay claim to a liberator's bogus laurels, the Libyan revolution they fanned and fuelled is in danger of degenerating into a chaotic, violent free-for-all.

Do not be misled by the fig leaf of this summer's national assembly polls. Post-Gaddafi Libya lacks viable national political leadership, a constitution, functioning institutions, and most importantly, security. Nationwide parliamentary elections are still a year away. The east-west divide is as problematic as ever. Political factions fight over the bones of the former regime, symbolised by the forthcoming trials of Gaddafi's son, Saif, and his intelligence chief, Abdullah al-Senussi.

Effective central control, meanwhile, is largely absent. And into this vacuum have stepped armed groups – whether politically, religiously or financially inspired matters little – all claiming sectional suzerainty over the multitude of fractured fiefdoms that was, until Nato barged in, a unified state.

Research published in June by the Small Arms Survey suggested that the emergence and influence of armed groups challenging national government and army was accelerating rapidly. The survey identified four distinct types including experienced revolutionary brigades accounting for up to 85% of all weapons not controlled by the state and myriad militias – loosely defined as armed gangs, criminal networks and religious extremists bent on exploiting post-revolution weakness.

A power struggle is now under way between the Libyan army and these various groups, and while some play a constructive role, others threaten the future of the Libyan state, the survey said. In Misrata, for example, in addition to about 30,000 small arms, revolutionary brigades "control more than 820 tanks, dozens of heavy artillery pieces, and more than 2,300 vehicles equipped with machine-guns and anti-aircraft weapons." Misrata, scene of some of the worst fighting last year, has become a state within a state.

In its weakened condition, politically and economically, Libya appears especially vulnerable to extremist ideology and foreign influence. In an echo of Taliban depredations, the Salafists who besieged the Benghazi consulate have also been involved in a wave of attacks on historic Sufi mosques and libraries and attempts to intimidate female university students who eschew the hijab.

In this they are reportedly encouraged by a Saudi-based scholar, Sheik Mohamed Al-Madkhalee, who issued a fatwa praising the desecration of Sufi graves and urging Libyan Salafists to do more to clear the country of the taint of Sufi worship. According to author Jamie Dettmer writing in the Daily Beast, the Libyan government has complained to Riyadh about al-Madkhalee, but to no avail.

Christopher Stevens was a respected diplomat who was helping hold Libya together in the wake of last year's upheavals. Maybe it was always an impossible task. But it was rendered all the harder by western politicians who, just as in Iraq, jumped feet first into a complex situation without sufficient care or thought for the future.