The United Nations has condemned an attempted coup in Libya that has seen a rival administration capture key government buildings, as both rebels and officials scrambled to win the support of Tripoli’s powerful militias.

The UN envoy Martin Kobler said: “I condemn the attempt to seize the headquarters of the high council of state. Such actions … will generate further disorder and insecurity and must end for the sake of the Libyan people.”

His comments came hours after armed units backed by trucks mounted with anti-aircraft guns seized buildings of the UN-backed government of national accord around Tripoli’s Rixos hotel complex, with local forces fleeing without a battle.

Libya is another tragic example of Cameron’s folly. History will not judge him kindly | Jonathan Freedland Read more

Fayez al-Sarraj, the GNA’s prime minister, and his seven-strong presidency council have spent the past week ensconced in a hotel in neighbouring Tunisia debating a new cabinet, after deciding the Libyan capital was unsafe.

The plotters have proclaimed the return of a former administration, the national salvation government, in what has so far been a bloodless takeover. Coup leader Khalifa al-Ghwell, a former prime minister, declared the GNA was now void after repeated failures. “The presidential council was given chances one after another to form the government, but it fails ... and has become an illegal executive authority,” he said.

Speaking from Tunisia, Sarraj vowed to restore order, calling on loyal militia units to “arrest the plotters immediately”. He said: “Arrest all those who plotted for the coup and those who are [looking at] forming parallel governments. This action by the GNC and the armed militias that backed its coup attempt helps add to the chaos in the country and leaves the door wide open for any group to assault the state institutions and buildings.”

Six months after arriving in Tripoli, the GNA has failed to establish a security force of its own, and with no police or army units in the capital, the city’s potent militias have emerged as kingmakers in the power struggle between rival governments. The struggle is itself part of a wider war, between militias in parts of the capital and western Libya against those loyal to the elected parliament based in the eastern town of Tobruk.

Parliament has so far refused to work with the GNA, and its hand was strengthened in September after its army commander, Khalifa Haftar, captured the country’s key oil ports giving it control of most of the oil industry.

Facebook Twitter Pinterest Fayez al-Sarraj, the GNA’s prime minister. Photograph: Aurelien Morissard/IP3/Getty Images

MPs are due to meet in Tobruk on Monday to debate events in Tripoli, but MP Salah Suhbi said they were likely to adopt a wait-and-see attitude towards the capital’s power struggle. “To be honest it is chaotic, we now have two governments [in Tripoli] – it is out of our hands,” he said. “The situation in Tripoli is getting out of control: it is a city with 150 militias in it.”

Diplomats had been pinning their hopes on the GNA being able to persuade the country’s splintered armed factions to unify behind it and end a two-year civil war, tackle Islamic State and end a rising tide of migration to Europe. Instead, the fledgling government has presided over a capital where militia violence and assassinations are rife, and citizens struggle with daily power cuts – one was in place when the coup broke out – cash shortages and rampant inflation.

Kidnappings, either for money or part of ongoing tit-for-tat militia wars, are endemic, prompting Britain’s Libya ambassador, Peter Millett, stationed for security reasons in neighbouring Tunisia, to call on the government to do more.

Peter Millett (@PeterMillett1) More kidnappings & killings in #Tripoli & across #Libya. Legitimate authorities improve security & tackle impunity https://t.co/5xLpikuRnB

Diplomatic sources have ruled out the deployment of foreign troops to back the government, although Britain and Italy earlier this year considered deploying 5,000 soldiers to train a new GNA army. But that new army has yet to be formed, with the government struggling to win popular support.

Instead, Tripoli’s militias hold the key to power. Sarraj will hope two key militias who have so far backed the GNA remain loyal: Rada, a quasi-police force in Tripoli; and those from Misrata, whose brigades are already heavily engaged in a war of attrition – backed by US airstrikes – against Isis in Sirte.

A European Union External Action spokesman said on Saturday: “The use of force to seize power in Libya can only lead to further disorder and a spiral of violence where the Libyan people would be the main victims.”

Some Tripoli citizens, with phone services disrupted by power cuts and computers powered by car batteries, tweeted their surprise that the coup had yet to trigger wider violence.

H.Rafferty1 (@HRafferty1) Woke up to a capital with 2 opposing resident govs. Everything is surprisingly ordinary...right down 2 the power cut. #Tripoli #Libya

Another, named Deena, expressed bewilderment at the latest twist in Libya’s chaotic power struggles, tweeting: “Game of Thrones #Libya Edition.”