“I gave my birth to my baby in a toilet – I lost her and now I’m dying as well,” says a woman weeping as she lies on a dirty floor, unable to walk after months without medical treatment.

She is one of thousands of women and children held indefinitely in Libya’s countless detention centres, caught in a lucrative trade between militias and people smugglers profiting from the worst refugee crisis the world has ever seen.

Elsewhere in the makeshift prison is a girl with two young boys aged four and six. They were rounded up, rescued and taken back to land after their boat capsized in the Mediterranean, killing their mother.

Another woman tells how she journeyed to Libya in the hope of making a better life for her family, but is now trapped as her children fall ill.

“I want to go back to my country,” she says. “I’m depressed, I’m tired, I was doing it to help the children. I don’t know what to do for them … I didn’t realise I was landing them in this home.”

Near Tripoli, the Fallah detention centre holds almost 900 men. When the Libyan guards’ backs are turned, they tell filmmakers how they were “beaten like animals” and called “slaves” by their captors.

Men queuing for food a the Fallah migrant detention centre near Tripoli, Libya (Supplied)

Those centres are controlled by the UN-backed Libyan government, but many more are under the control of the numerous militias and armed groups operating in the country that have forced migrants from across Africa into work camps and brothels.

Rare access to the squalid system was granted a new documentary aiming to shed light on the plight of thousands of asylum seekers in Libya who are detained, tortured, raped and sold like slaves into labour or prostitution.

The only escape many can find is on a flimsy boat into the Mediterranean Sea – a journey that claimed more than 4,500 lives last year alone.

Britain is among the European countries increasing cooperation with Libya to slow the crossings but the war-torn country’s fledgling Government of National Accord (GNA) have been powerless to stop warring militias profiting from exploiting desperate refugees.

The UK is helping train the Libyan coastguard, which is being given increasing responsibility for “rescue” missions, but new footage to be broadcast by Sky shows its staff beating and whipping refugees in a boat.

[DO NOT USE] Libyan smuggler reveals how migrants charged thousands for deadly journeys

A crew filming the documentary Ross Kemp: Libya’s Migrant Hell had been allowed to board the vessel on its 12-hour operation from the port of Zawiyah in September, as boat launches from Libya were peaking.

The former EastEnders actor said the coastguard showed little concern as they attacked refugees from sub-Saharan Africa, having already been accused of causing at least 25 people to drown in the panic caused by a similar attack.

“They seemed to take a bit too much pleasure in [the beating],” he told The Independent.

“They left them for hours in the sun without water and food, then they took them to detention centres, splitting up families.

“If you’re going to do that you also have a responsibility to ensure they’re treated as human beings, and they’re not. Turning them back isn’t going to stop them coming, it’s inhuman.”

Refugees forced back to land by Libyan authorities are taken to detention centres spread along the country’s coast – some controlled by the government and others by powerful militias that have carved the country up since the UK-backed ousting of Muammar Gaddafi in 2011.

They are held for months, before being moved or sold on to smugglers to attempt the treacherous crossing once more.

Migrants on a Libyan coastguard boat off the coast of Zuwiyah in September 2016 (Supplied)

Some are said to be taken to Libya’s southern border, although rumours of people being abandoned and left to die in the desert abound.

Asylum seekers The Independent met on a rescue vessel in the Mediterranean told of horrors including rape, murder and torture, with several still bearing the scars.

One man still had a bullet wound in his leg from when he was shot while making his escape from a gang-controlled prison, while another was left unable to walk by the extent of his injuries.

But with the UN and humanitarian organisation unable to operate fully in Libya due to the ongoing conflict, there has been little proof of the atrocities perpetrated against refugees on the ground.

Reports detailing the atrocities in Libya have so far been afforded little political attention but the footage may force public efforts to ensure attempts to slow arrivals to Europe do not fuel human rights abuses.

Mr Kemp said he feared Europe was adopting an “out of sight, out of mind approach” to the refugee crisis as it enters its third year.

“These people are being treated like commodities,” he added. “Their own countries don’t want them, Libya certainly doesn’t want them and Europe doesn’t want them – so what happens to them?”

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

The documentary’s director, Marta Shaw, said it would be tantamount to “signing a death sentence” to force refugees attempting to cross the Mediterranean back to Libya.

“Outsourcing the policing of our borders to Libya isn’t the solution,” she added.

Nato has received a request from the Libyan government for support, while world leaders agreed to help bolster its capability at a summit in Malta earlier this month and Italy has pledged millions of euros in funding for anti-smuggling initiatives.

Jalal Othman, the GNA’s director of communications, said Libyan authorities were taking the allegations “very seriously” and would study the footage closely while continuing cooperation with the EU.

“The Libyan judicial and law-enforcement systems are facing extreme pressures at this time due to the very challenging security situation in the country,” he added.

“We are in the process of building an effective Presidential Guard to provide security in Tripoli and beyond.

“We condemn all mistreatment of migrants without reservation. While we have to be realistic about the state’s current law-enforcement capacity, action will be taken wherever possible against those who break the law.”

A Government spokesperson told The Independent: “The UK remains committed to working with international partners to support the Libyan Government of National Accord.

“We're aware of reports, take all allegations of human rights abuses very seriously, and take them into consideration for any support we provide overseas.”