UN chief Antonio Guterres pushed Friday to avoid a military escalation in Libya, meeting commander Khalifa Haftar a day after his troops launched an offensive to take the capital Tripoli.
The lightning assault by forces loyal to Haftar was met with international appeals for restraint and an emergency meeting by the UN Security Council to be held later Friday.
"I leave Libya with a deep concern and a heavy heart. I still hope it will be possible to avoid a bloody confrontation in and around Tripoli," Guterres said in a statement.
The United Nations chief met with Haftar in the eastern city of Benghazi, an official from his self-proclaimed Libyan National Army told AFP without giving further details.
Forces loyal to Haftar were pushed back Friday from a key checkpoint less than 30 kilometres (18 miles) from Tripoli, checking their offensive on the capital, a security source said.
Pro-government militiamen from the coastal town of Zawiya, west of Tripoli, retook the base after a "short exchange of fire", the source said on condition of anonymity.
The head of the UN-backed unity government, Fayez al-Sarraj, visited the checkpoint on Friday accompanied by military commanders.
'The time has come'
The Zawiya militia is one of dozens that have proliferated since the 2011 overthrow of dictator Moamer Kadhafi and are variously aligned with Sarraj's government and a rival administration in the east backed by Haftar.
Most of the pro-Haftar fighters who briefly captured the checkpoint late on Thursday were rival militiamen from the town of Sabratha, further west along the Mediterranean coast.
Dozens of them were captured and their vehicles seized, the security source said.
The Tripoli Protection Force, an alliance of pro-government militias in the capital, said its fighters had taken part in the recapture of the checkpoint.
A convoy of vehicles from Haftar's forces on Thursday pushed towards the city of Gharyan, some 100 kilometres south of Tripoli on Thursday, witnesses and military sources said.
Haftar said "the time has come" to take Tripoli in an audio message released on Thursday, pledging to spare civilians and "state institutions".
The announcement of the offensive came as Guterres was in Tripoli for talks with Sarraj, ahead of a conference later this month on organising elections.
Sarraj on Thursday condemned Haftar's "escalation" and said he had ordered loyalist forces to prepare to "face all threats".
Avoid 'renewed bloodshed'
The United States and its allies issued a joint statement urging "all parties to immediately de-escalate tensions".
"At this sensitive moment in Libya's transition, military posturing and threats of unilateral action only risk propelling Libya back toward chaos," they said.
Russia called for "all possible efforts to fully resolve the situation with peaceful political means".
"We believe that the main thing is for any actions not to lead to renewed bloodshed," Kremlin spokesman Dmitry Peskov told reporters.
Analysts say the advance by Haftar's forces comes at a key moment as the UN bids to get elections back on track after an abortive effort last year.
"The risk of a flare-up has increased," said Jalel Harchaoui, a researcher at Clingendael Institute in The Hague.
"Capturing Tripoli... remains a possibility" for Haftar, with the support he receives from Saudi Arabia and its allies Egypt and the United Arab Emirates, he said.
Haftar held talks in Riyadh late last month and his forces have reportedly received major arms deliveries from the UAE, including aircraft, despite a UN embargo.
They already overran most of the remote oil fields and oasis cities of the desert south during an offensive earlier this year.
The government's writ is now largely confined to the narrow coastal strip around Tripoli and third city Misrata to its east.