The UN has accused Britain and other countries backing Libyan forces of “turning a blind eye to the unimaginable horrors endured by migrants” in efforts to stem the refugee crisis.

Zeid Ra’ad al-Hussein, the High Commissioner for Human Rights, said the situation for thousands of migrants detained in Libya was “deteriorating fast” as EU member states increase support for fragile authorities in the war-torn country.

“The suffering of migrants detained in Libya is an outrage to the conscience of humanity,” he said.

“What was an already dire situation has now turned catastrophic...the international community cannot continue to turn a blind eye to the unimaginable horrors endured by migrants in Libya, and pretend that the situation can be remedied only by improving conditions in detention.”

Britain is among the countries supporting the Libyan coastguard as it increases efforts to intercept migrant boats and take those on board to land before they can be rescued and taken to Italy.

The Ministry of Defence is training members of the force, which stands accused of beating and shooting migrants, causing fatal sinkings and attacking international rescue ships.

Some Libyan officials are also taking bribes to free detained migrants who then attempt crossings for a second time, The Independent revealed last month.

Humanitarian groups have warned that returns from international waters violate international law by forcing asylum seekers back to a country where they modern slavery, abuse and death.

Boris Johnson meets members of the Libyan coastguard, who were trained by the Royal Navy, at a Libyan naval base in Tripoli on 23 August (PA)

The UN said support for coastguard operations was condemning “more migrants to arbitrary and indefinite detention and exposing them to torture, rape, forced labour, exploitation and extortion”.

According to Libya’s Department of Combatting Illegal Migration (DCIM), 19,900 people are being held in facilities under its control, up from about 7,000 in September, when authorities detained thousands of migrants following fighting between militias and smugglers in Sabratha.

Thousands more are being held by armed groups running rampant across lawless swathes of the country, seeing gangs extract profit by ransoming migrants or forcing into labour, prostitution or other forms of modern slavery.

Those detained by either official or unofficial groups have no possibility to challenge the legality of their detention and no access to legal aid.

“The detention system for migrants in Libya is broken beyond repair,” said Mr al-Hussein.

“Only alternatives to detention can save migrants’ lives and physical security, preserve their dignity and protect them from further atrocities.”

UN human rights monitors who visited four DCIM facilities in Tripoli earlier this month said they found thousands of “emaciated and traumatised men, women and children piled on top of each other, locked up in hangars with no access to the most basic necessities, and stripped of their human dignity”.

An NGO rescue ship photographed what appeared to be a Libyan coastguard officer pointing a weapon at refugees (far right) (Jugend Rettet)

A man held alongside 2,000 others at the Tarik al-Matar DCIM centre, told UN staff: “We are like a box of matches, we don’t sleep, we have diseases, we lack food, we didn’t shower for months. We will all die if not saved from this place, this is Calvary, it is excessively difficult to survive the smell of faeces and urine, many are [lying] unconscious on the floor.”

Many migrants described regular beatings at the hands of guards, some armed with “electric sticks”, after asking for food, water, medical treatment and information.

Female migrants, who are frequently raped by smugglers and militias, said they were also targeted by Libyan officials.

One detained woman told the UN: “I was taken away from the DCIM centre and raped in a house by three men including a DCIM guard.”

Despite mounting evidence of abuses, the Ministry of Defence has embarked on a third round of training which started in October 2016, taking on 60 Libyan coastguard members in total.

Two rounds of programmes including human rights education have been completed offshore and a classroom-based course on maritime law, navigation and boat-handling is underway at a military base in Italy.

Meanwhile, the EU has steadily been increasing its cooperation with Libya’s fragile Government of National Accord (GNA), following the arrival of hundreds of thousands of migrants in crossings which have killed more than 15,000 men, women and children over the past four years.

Proponents have argued the efforts see refugees “rescued” from the treacherous journey but Mr al-Hussein said the increasing interventions have “done nothing so far to reduce the level of abuses suffered by migrants”.

He urged Libyan authorities to end migrant detention, to take concrete steps to combat abuse in centres under their control, to remove, investigate and prosecute those responsible and to “publicly signal that such abuses will no longer be tolerated”.

In pictures: A day of refugee rescues in the Mediterranean Sea Show all 7 1 /7 In pictures: A day of refugee rescues in the Mediterranean Sea In pictures: A day of refugee rescues in the Mediterranean Sea A baby being taken on to MSF's Bourbon Argos ship from a boat carrying 130 migrants and refugees Lizzie Dearden In pictures: A day of refugee rescues in the Mediterranean Sea A refugee boat carrying 101 people being rescued by MSF's Bourbon Argos Lizzie Dearden In pictures: A day of refugee rescues in the Mediterranean Sea A refugee boat carrying 101 people being rescued by MSF's Bourbon Argos all images by Lizzie Dearden In pictures: A day of refugee rescues in the Mediterranean Sea A baby among refugees on a boat carrying 185 people off the coast of Libya Lizzie Dearden In pictures: A day of refugee rescues in the Mediterranean Sea Migrants and refugees sleeping after being rescued by MSF's Bourbon Argos ship Lizzie Dearden In pictures: A day of refugee rescues in the Mediterranean Sea A crew from MSF's Bourbon Argos ship rescuing a boat carrying 130 migrants and refugees off the coast of Libya, at sunrise Lizzie Dearden In pictures: A day of refugee rescues in the Mediterranean Sea A woman in a stretcher being lifted onto MSF's Bourbon Argos ship from a boat carrying 130 migrants and refugees off the coast of Libya Lizzie Dearden

Mr al-Hussein also called for the creation of domestic legal measures and the decriminalisation of irregular migration to ensure the protection of thousands of men, women and children attempting to reach Europe, adding: “We cannot be a silent witness to modern day slavery, rape and other sexual violence, and unlawful killings in the name of managing migration and preventing desperate and traumatised people from reaching Europe’s shores.”

Dimitris Avramopoulos, the European Commissioner for migration, told a press conference in Brussels that he had “taken note” of the UN’s comments.

“We are working on all fronts to address the dire situation on the ground in Libya and to protect these people,” he told a press conference in Brussels on Wednesday.

“It is precisely thanks to our joint and international cooperation that we are achieving these results.”

Mr Avramopoulos said he had met with the UN High Commissioner for Refugees, Filippo Grandi, to discuss the EU’s strategy.

A spokesperson for the GNA previously told The Independent: “The Libyan government takes these allegations very seriously. We have a zero tolerance for corruption in any instances and will investigate these very serious allegations before taking the appropriate action.

“We are doing our best, in the most difficult circumstances imaginable, to provide appropriate facilities for migrants onshore and protective measures of our coastline offshore. We are committed to fighting illegal human trafficking with our international partners.”

Almost 157,000 migrants have arrived in Europe by sea this year, mainly on the passage between Libya and Italy, and 2,992 are known to have died in the attempt.