BENGHAZI, Libya -- Militias in western Libya fought forces under rival army commander Khalifa Hifter 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 U.N. chief wrapped up his visit 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 Hifter, 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 U.N.-backed Presidential Council and Government of National Accord and supporting militias.
A well-informed U.N. diplomat said late Friday that Hifter'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 authorized to speak publicly.
A showdown between Hifter'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 Gadhafi.
It would also put at risk upcoming peace talks between rivals brokered by the U.N. and aimed at drawing a roadmap for new elections. Those talks are scheduled for April 14-16.
The U.N. Security Council held an emergency closed-door meeting Friday at Britain's request and called on Hifter'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 U.N. 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 U.N. political process."
Hifter's troops on Thursday captured the town of Gharyan, some 50 kilometers (31 miles) south of Tripoli without a fight, putting them closer to the militias than ever before.
Hifter 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 mobilized to confront Hifter.
"We are the revolutionaries and the elders ... we declare we are in full mobilization 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 Hifter's soldiers were captured by Zawiya militias, said army spokesman Ahmed al-Mesmari. He said the soldiers' commander was being investigated.
Anti-Hifter 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 Hifter's son, Khaled. It's one of the largest units Hifter has deployed to march on Tripoli.
Also, Misrata militias launched an airstrike targeting Hifter'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 center 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 Hifter'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-Sissi, who is an army chief turned president.
The renewed fighting came a day after U.N. Secretary General Antonio Guterres arrived for his first visit to Libya as U.N. 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 Agila Saleh, head of the east-based parliament, according to spokesman Abdullah Ablahig.
"I am leaving Libya with heavy heart and deep concern," he told reporters at the airport shortly after meeting with Hifter.
"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. Hifter has recently seized much of southern Libya without fighting.
Several governments and organizations urged de-escalation, including those known to be Hifter's key backers, such as France and the United Arab Emirates, without specifically mentioning the commander.
Associated Press writers Maggie Michael in Cairo, Edith M. Lederer at the United Nations, Vladimir Isachenkov in Moscow, Lorne Cook in Brussels and Colleen Barry in Rome contributed to this report.