Guterres said in a report to the Security Council released on Thursday that torture and arbitrary detention is widespread in Libya.
About 6,400 detainees are held in 26 official prisons but “thousands of others” are being held in facilities with little government control or “directly run by armed groups,” said the report.
“I remain deeply concerned about widespread human rights violations and abuses committed in the context of detention and the prolonged arbitrary detention of thousands of men, women and children without due process,” wrote Guterres.
The government must protect detainees against torture and “all prisons must be under effective government control and free of any influence or interference of armed groups,” he added.
Libya descended into chaos following the 2011 overthrow of Muammar Gaddafi that has seen a bitter rivalry emerge between two governments scrambling for control in the oil-rich north African country.
The United Nations backs the government in Tripoli but is working toward holding elections, possibly this year, to unite the country.
Guterres also reported that an increase in the number of migrants and refugees who were detained over the past six months was a result of more interceptions at sea and the closure of sea routes to migrants.
About 5,300 refugees and migrants have been detained in Libya of whom 3,700 were in need of international protection, he said.
In all, there are over 669,000 migrants in Libya, of whom women and children make up 21 percent, according to the report.