Forces loyal to the eastern Libyan commander Khalifa Haftar were pushed back on Friday from a key checkpoint less than 30km from Tripoli, checking their lightning advance on the capital, a security and military sources have said.
Pro-governmental militiamen from the coastal town of Zawiya, west of Tripoli, retook the base in Janzour after a "short exchange of fire," the security source told the AFP news agency on condition of anonymity.
Mohamed Alhudairi, commander of the operations room for the western region, told the Reuters news agency that forces allied to the internationally recognised government in Tripoli had taken 145 troops prisoner during the fighting in Zawiya.
Alhudairi said 60 vehicles belonging to the eastern forces had also been confiscated.
Another eastern military source told Reuters that 128 men had been captured, without elaborating.
The Zawiya militia withdrew overnight from the so-called Gate 27 checkpoint, leaving it abandoned in the morning, a Reuters reporter said.
Traffic was flowing normally past the checkpoint on Friday morning, an AFP correspondent reported.
Just a single armoured vehicle was seen. The allegiance of its occupants was not immediately clear.
Other militias allied to the Tripoli administration were also reported to have moved more machine-gun-mounted pickups from the coastal city of Misrata to the capital to defend it against Haftar's forces.
UN chief meeting Haftar
The advance by Haftar's forces on Thursday, which came as the United Nations prepares to convene a conference later this month on organising delayed elections, prompted UN chief Antonio Guterres to voice his "deep concern".
Guterres was in Tripoli for talks with Fayez al-Sarraj, the head of the UN-backed unity government, when the offensive was announced.
On Friday, Guterres held talks with Haftar after flying to Benghazi and driving to the commander's base.
He earlier went to Tobruk, another eastern city, to meet Aguila Saleh, president of the House of Representatives, which is also allied to Haftar.
Saleh's spokesman said they had discussed ways to end the crisis and the planned conference, without giving details
"My aim remains the same: avoid a military confrontation. I reiterate that there is no military solution for the Libyan crisis, only a political one," Guterres said on Twitter.
The UN Security Council was also to hold an urgent meeting on the crisis as Western governments appealed for restraint.
The Zawiya militia is one of dozens that have proliferated since the overthrow of longtime ruler Muammar Gaddafi in a NATO-backed uprising in 2011.
The group's fighters have been variously aligned with the government in the capital and a rival administration in the east backed by Haftar's forces.
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.
Pictures posted on social media of men in military uniform sitting on the ground purported to show some of those taken prisoner, but their authenticity could not immediately be verified.
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.
'At the gates of the capital'
A convoy of vehicles from Haftar's forces had on Thursday pushed towards the city of Gharyan, some 100km south of Tripoli, witnesses and military sources said.
Haftar said "the time has come" to take the capital in an audio message released on Thursday, pledging to spare civilians and "state institutions".
His forces' spokesman Ahmed Mesmari said they were "at the gates of the capital" on Thursday evening.
Sarraj on Thursday condemned Haftar's "escalation" and said he had ordered loyalist forces to prepare to "face all threats".
Russia said it was not helping Haftar's forces and it supported a negotiated political settlement that ruled out any new bloodshed.
"The situation should be resolved peacefully," Kremlin spokesman Dmitry Peskov said.
Former colonial power Italy, which lies across the Mediterranean from Libya, was very worried by the turn of events, Italian Deputy Prime Minister Matteo Salvini said.
"We need to throw water on the fire, not petrol on the fire," Salvini said.
"I hope that people, acting out of economic or business self-interest, is not looking for a military solution, which would be devastating."
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.
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.
Haftar - who receives support from Saudi Arabia and its allies Egypt and the United Arab Emirates - 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 had 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 the third city of Misrata to its east.