A UN delegation held talks in Tripoli on Friday to try to broker a ceasefire between armed factions that have turned the Libyan capital and Benghazi into battlegrounds in the worst fighting since the fall of Muammar Gaddafi.
Most Western governments followed the United States and the United Nations in evacuating diplomats and shutting embassies after three weeks of militia fighting over Tripoli airport that have killed more than 200 people.
The delegation, led by a representative of the United Nations mission in Libya, known as UNSMIL, aims to end the violence, help displaced residents and alleviate shortages of food and basic services, UNSMIL said in a statement.
"UNSMIL is working closely with the international community in a joint effort to achieve a durable and sustainable ceasefire," it said, giving no further details on who UN officials were meeting in Tripoli.
Tripoli was mostly calm on Thursday and Friday, the quietest days since the clashes erupted between Islamist-allied Misrata brigades and fighters from the western town of Zintan who control the international airport.
Benghazi was also quieter a week after an alliance of Islamist fighters and former rebels took a special forces army base and a police headquarters following days of heavy clashes involving air force jets and attack helicopters.
Three years after the fall of Gaddafi, Libya's fragile government is unable to impose authority on groups of former rebels who refuse to disband and are allied with competing political factions battling for post-war dominance.
Many of the militia brigades are paid by the government as semi-official security forces, each claiming to be legitimate and each holding vast arsenals of tanks, cannons and rockets taken from Gaddafi's arms dumps after the war.
But they are often more loyal to their political patrons, commanders, regions or cities than to the Tripoli government. Fighting since last month over the airport involves two loose factions of ex-rebels whose rivalries have erupted since they rushed to claim parts of the capital after Gaddafi's fall.
On one side are Zintanis, and their anti-Islamist Qaaqaa and Al Sawaiq brigades, including some former Gaddafi forces, who present themselves as a bastion against Islamist extremists and the Muslim Brotherhood.
Against them are brigades from the western port of Misrata, allied with Islamist political forces and other militias, who say they are fighting to clear out remnants of Gaddafi's army.
Zintan forces, who control the airport, have said they are ready for a ceasefire, but Misrata forces - including the Libya Shield brigades which are attacking the airport - say they will not accept any agreement until the Zintan forces leave Tripoli.
Three years after NATO air strikes helped rebels defeat Gaddafi forces on the ground, Western partners worry Libya is sliding deeper into armed chaos just across the Mediterranean sea from mainland Europe.
Libyan officials have urged international partners to help, and the new parliament has called for a United Nations-backed ceasefire to be put in place between the warring factions who have become increasingly polarised.
Acting Prime Minister Abdullah al-Thinni told Al-Hurra television in an interview aired on Thursday that Libya was at a "crossroads", and called on Western partners to help the country build its army and state institutions.
"To be honest, Western countries do not want any military intervention because of what happened in the other countries such as Syria and Iraq," he said in Washington where he was meeting U.S. officials.
"But we asked for more involvement in the Libyan issue, as the international community already moved to help the Libyan revolution. So they should complete the process of building the Libyan state and its institutions."
He said that should involve training and arming Libya's national state forces with experts.
"We did not ask for a traditional military intervention," he said.
A ceasefire would bring relief to Tripoli, as residents have struggled with gasoline shortages and power cuts since the fighting began, mostly in the southern districts around the airport, where militia fighters have established frontlines.
But beyond a temporary reprieve, a broader political agreement between the two forces may prove more elusive.
Political infighting between Islamist forces and a more nationalist-leaning alliance paralysed the last parliament, in which the Islamist Justice and Construction Party, seen as close to the Muslim Brotherhood, was more influential.
With political factions siding with rival armed brigades, militia fighters often stormed the General National Congress to exert military pressure in favour of their political patrons, leaving the country's transition in tatters.
The newly elected House of Representatives which replaced the General National Congress, has been holding sessions in the eastern city of Tobruk, far from the clashes in Libya's two main cities, and has called for a unity government.
But Islamist factions and the main Islamist party have rejected the sessions held in Tobruk as unconstitutional, complicating Western calls for the new legislature to be a space for reaching a political agreement between factions.
(Editing by Louise Ireland)