In a new report, the human rights organization claims that in an effort to stem the tide of migration, European Union capitals are knowingly funding Libyan authorities, primarily the coastguard, who work with human traffickers and various armed groups.
Around 20.000 migrants are now held across 42 detention centers under the control of the Interior ministry of the Government of National Accord (GNA).
More than 400,000 migrants are believed to be in the country including in areas outside government control, according to the International Organization for Migration.
"In view of the current critical humanitarian situation in Libya and the appalling conditions in detention centres, UNHCR once again calls upon the solidarity of the global community", said Turk.
He charged that "by supporting Libyan authorities in trapping people in Libya".More news: Google Maps will soon track your public transit journey in real time
With Libya being largely a lawless states since the fall of veteran ruler Muammar Gaddafi, some European Union officials and diplomats chafe at what they see as being forced to rely on sometimes shady characters in the matrix of alliances between militias.
Recent investigations by Middle East Eye revealed that armed groups have been stopping migrant boats from leaving Libya in exchange for aid, aircraft hangars and large sums of money.
The International Organisation for Migration (IOM) identified 432,574 migrants in Libya, with estimates of the number being much higher.
Libya is the main gateway for migrants trying to cross to Europe by sea, though numbers have dropped sharply since July as Libyan factions and authorities have begun to block departures under pressure from Italy, the main landing point. This approach received the complete backing of other European governments.
The presidency of Libya's United Nations -backed government said last month it was a victim of illegal migration, not a source of it, and appealed to foreign powers to help stop flows from migrants' countries of origin.
The code of conduct put restrictions on the search and rescue activities in Libyan waters, and limits the transfer of rescued people from one rescue vessel to another.