The U.N. chief says he's worried about a major armed showdown in Libya and is urging warring factions to instead turn to dialogue.

Antonio Guterres' remarks came as Libyan forces loyal to strongman Khalifa Hifter entered the town of Gharyan, about 50 kilometers, or 31 miles, south of the capital. It's the closest to Tripoli that Hifter's fighters reached in their campaign westwards from the country's east.

Guterres posted on Twitter on Thursday that he's "deeply concerned by the military movement taking place in Libya and the risk of confrontation."

He added: "There is no military solution. Only intra-Libyan dialogue can solve Libyan problems."

Guterres arrived in Libya on Wednesday — the first U.N. chief to visit since the 2011 uprising that toppled and later killed long-time ruler Moammar Gadhafi.