Benghazi: The UN chief expressed concern Thursday about a possible major armed showdown over Libya’s capital, urging rival factions to instead turn to dialogue as forces loyal to a self-proclaimed army commander captured a town near Tripoli.

The remarks by UN Secretary-General Antonio Guterres came during his visit to Libya, which began Wednesday.

It’s the first by a UN chief since the 2011 uprising that toppled and later killed Libya’s long-time ruler Muammar Gaddafi.

Guterres, who is to hold a presser in Tripoli later on Thursday, said on Twitter that he is “deeply concerned by the military movement taking place in Libya and the risk of confrontation.”

“There is no military solution,” he said.

“Only intra-Libyan dialogue can solve Libyan problems.”

But on the ground, forces loyal to strongman Marshal Khalifa Hafter, who commands the self-styled Libya National Army that’s based in the country’s east, took control overnight of the town of Gharyan, 50 kilometres from Tripoli, without major clashes.

It’s the closest Haftar’s forces have made it to Tripoli and fears are looming they will march on toward the capital, setting the stage for a major confrontation.

Tripoli is under control of a weak UN-backed government and aligned militias, which are rival to the east-based administration and Haftar’s army.

“I am sipping coffee now in Gharyan,” Haftar’s top aide Abdul Salam Al Hassi told The Associated Press over the phone.

“God willing, we will enter the rest of the cities without clashes.”

He declined to comment on the force’s upcoming steps.

Skirmishes were reported overnight in the mountain district of Al Assabaah, near Gharyan, in which two of Haftar’s fighters were killed, according to the force’s media office.

Haftar’s army has waged a military campaign, spreading its footprint from eastern Libya where it first battled mostly Islamist militias and Islamist groups, starting in 2014. The campaign then extended southward as Haftar’s forces took control of key towns and border crossings earlier this year and now is pushing west, toward Tripoli.

Since Gaddafi’s ouster and killing, Libya has descended into chaos, with two rival administrations and an array of militias fighting over power and oil fields.