Militias in western Libya fought forces under rival army commander Khalifa Haftar on Friday, capturing 100 of his soldiers and waging an airstrike on one of his positions a day after he declared an offensive to seize Tripoli, the capital of the oil-rich nation.The violence came as the UN chief wrapped up his visit on Friday aimed at avoiding an expanded conflict and said he left with a "heavy heart and deep concern".The escalation comes after forces commanded by Haftar, who runs the self-styled Libya National Army based in the country's east, pushed westward. He brought his troops closer to Tripoli, which is controlled by the UN-backed Presidential Council and Government of National Accord and supporting militias.A well-informed UN diplomat said late on Friday that Haftar's forces were reported to be on the outskirts of Tripoli. So were militias from the western city of Misrata who now control everything from the eastern edges of the capital to Libya's western border, the diplomat said, speaking on condition of anonymity because he was not authorised to speak publicly.A showdown between Haftar's army and the militias could plunge Libya into another spasm of violence, possibly the worst since the 2011 civil war that toppled and later killed longtime dictator Moammar Gaddafi.It would also put at risk upcoming peace talks between rivals brokered by the UN and aimed at drawing a roadmap for new elections. Those talks are scheduled for April 14-16.'We are coming Tripoli, we are coming'The UN Security Council held an emergency closed-door meeting on Friday at Britain's request and called on Haftar's forces to halt all military movements. It also urged all Libya forces "to de-escalate and halt military activity".After a briefing by the UN envoy for Libya, Ghassan Salame, the council said there can be no military solution to the conflict. Council members "called on all parties to resume dialogue and deliver on their commitments to engage constructively with the UN political process".Haftar's troops on Thursday captured the town of Gharyan, some 50km south of Tripoli without a fight, putting them closer to the militias than ever before.Haftar then ordered his forces to march on the capital, saying in an audio recording posted online: "We are coming Tripoli, we are coming." He also urged his forces to enter the city peacefully and only raise their weapons "in the face of those who seek injustice and prefer confrontation and fighting".The march appeared to have faced a set-back on Friday, however.Militias from the western cities of Zawiya and Misrata, which control Tripoli, said they had mobilised to confront Haftar."We are the revolutionaries and the elders ... we declare we are in full mobilisation and war," they said in a video statement posted online.A group of allied militias called the Joint Tripoli Protection Force based in the area around the Libyan capital announced they would also deploy to repel Hifter's offensive.Over 100 of Haftar's soldiers were captured by Zawiya militias, said army spokesperson Ahmed al-Mesmari. He said the soldiers' commander was being investigated.Anti-Haftar activists on social media posted pictures of what they described as militiamen from Zawiya capturing dozens of Hifter's forces and armored vehicles carrying stickers reading "106th Battalion". The unit is known to be commanded by Haftar's son, Khaled. It's one of the largest units Haftar has deployed to march on Tripoli.'I am leaving Libya with heavy heart and deep concern'Also, Misrata militias launched an airstrike targeting Haftar's position at the foot of the mountains of Nafusa, he said. He didn't elaborate on the number of casualties.In Tripoli, council member Mohammed al-Ammari spoke from the city centre saying that Libya will not become a "hostage in hands of a military dictator once again".There were conflicting reports during the day as to how much and where exactly Haftar's fighters were advancing in areas such as Souk al-Khamis.Clashes erupted at night in the western district of Qasr Bani Ghashir, close to Tripoli International airport, which was destroyed in 2014 fighting. Former lawmaker Abdel-Raouf al-Manaei said the forces fighting under the umbrella of the Government of National Accord will not permit "a replica of el-Sissi military rule in Libya," in reference to the authoritarian Egyptian President Abdel-Fattah el-Sisi, who is an army chief turned president.The renewed fighting came a day after UN Secretary General Antonio Guterres arrived for his first visit to Libya as UN chief. On Friday, Guterres went to the eastern region, which is the seat of a rival administration and parliament that Hifter is aligned with.Guterres met with Aguila Saleh, head of the east-based parliament, according to spokesperson Abdullah Ablahig."I am leaving Libya with heavy heart and deep concern," he told reporters at the airport shortly after meeting with Haftar."I still hope, if possible, to avoid armed confrontation around Tripoli," he said. "The United Nations remains available to facilitate any political solution."Since Gadhafi's ouster, Libya has been split between rival governments in the east and the west and an array of militias fighting over power and oil fields. Haftar has recently seized much of southern Libya without fighting.Several governments and organisations urged de-escalation, including those known to be Haftar's key backers, such as France and the United Arab Emirates, without specifically mentioning the commander.