General Mohammad Bishr, head of a government department set up to tackle clandestine migration, said the number of migrants held by authorities had fallen from 27,000 in May to 5,200.
He said that had allowed the closure of 20 of the country’s 53 migrant detention centres since May 2017.
He attributed the change to the accelerating repatriation of migrants, particular by the International Organization for Migration (IOM).
Several African countries have also repatriated hundreds of their nationals, particularly since a CNN report showing what appeared to be a slave market in Libya.
Bishr said many of the migrants still in the country, particularly from Ethiopia, Somalia or Eritrea, are recognised by the United Nations as refugees and are waiting to be sent to third countries.
Some 48,000 refugees are registered in Libya, according to the UN’s refugee agency UNHCR, which hopes to transfer between 5,000 and 10,000 refugees to third countries in 2018.
In the chaos that followed the fall and killing of former dictator Moamer Kadhafi in a 2011 uprising, Libya has become a key transit point for sub-Saharan African migrants seeking to embark on dangerous journeys to Europe.
A UN panel of experts found in February that human trafficking is on the rise in the North African country and that Libyan forces may be helping rebel groups tighten their control of smuggling routes.
Many migrants face harsh treatment and exploitation in Libya.
Bishr acknowledged that conditions in centres run by the country’s unity government were not ideal.
“But we try to provide a minimum of services to the most vulnerable, especially women and children,” he said.
Download our app and read this and other great stories on the move. Available for Android and iOS.