The U.N. mission in Libya says two local TV reporters detained by forces loyal to a commander who is on the offensive to capture the country’s capital, Tripoli, have been released after three weeks in captivity.

Libya’s Alahrar TV station said commander Khalifa Hifter’s self-styled Libyan National Army detained two of its journalists, Mohamed al-Qarg and Mohamed al-Shibani, earlier this month.

The TV station, which backs the U.N.-supported government in Tripoli, said the journalists were released on Friday.

FILE - In this Aug. 14, 2017 file photo, Libyan militia commander General Khalifa Hifter meets with Russian Foreign Minister Sergei Lavrov in Moscow, Russia. Libyan commander Khalifa Hifter is in Paris Wednesday May 22, 2019 for meetings with French President Emmanuel Macron amid growing international concern about his month-long offensive to take Libya's capital Tripoli. (AP Photo/Ivan Sekretarev, File)
FILE – In this Aug. 14, 2017 file photo, Libyan militia commander General Khalifa Hifter meets with Russian Foreign Minister Sergei Lavrov in Moscow, Russia. Libyan commander Khalifa Hifter is in Paris Wednesday May 22, 2019 for meetings with French President Emmanuel Macron amid growing international concern about his month-long offensive to take Libya’s capital Tripoli. (AP Photo/Ivan Sekretarev, File)

The U.N. said late Saturday that it welcomed their “safe return to their families” in the western city of Zintan.

Hifter’s forces are locked in weeks-long fighting to take Tripoli against militias loosely allied with the U.N.-supported government. The fighting has reportedly killed at least 510 people, including combatants and civilians.