“Some around the world are arguing that human rights are outdated, that national interest can justify the suppression of individual and collective rights,” declared Federica Mogherini, the EU’s foreign policy chief, last week at the UN general assembly. “We are here today to state the opposite … Human rights are real.”

As she said this, I was getting desperate WhatsApp messages from some of the thousands of refugees locked up indefinitely in detention centres in Tripoli, after being forced back to Libya under EU policy.

The same day, hundreds in the Abu Salim detention centre had been threatened by unknown men with guns, while a pregnant woman collapsed from sickness amid heavy rain. Since 26 August, Tripoli has experienced the worst fighting in years, as rival militias fight to take control of the city. As the UN-backed government declared a state of emergency and shells began to fall indiscriminately, refugees and migrants were abandoned or released on to the dangerous streets. Some resorted to drinking toilet water to survive. Others were stuck on front lines, shot at or abducted by suspected traffickers, or cowered together as bombs went off beside them.

Using a smartphone shared among hundreds of people, the first group contacted me to appeal for help after one man’s brother found my number online. Since then, around 20 more migrants and refugees have got in touch, describing periods of up to five days without food, sending pictures of men with anti-aircraft missiles driving around outside, or photos showing a newborn baby, whose mother gave birth inside an open hall as the conflict raged on.

“The buildings around us are smoking,” one Eritrean man messaged me, as he pleaded for evacuation – something that Médecins Sans Frontières (MSF) has repeatedly called for.

Europe’s “stop the boats” policy now resembles Australia’s, as African migrants and refugees are locked up indefinitely after being returned to Libya by the EU-backed Libyan coastguard. They have no recourse to judicial review, instead waiting for help from the UN, while praying not to be sold to traffickers by Libyan authorities who regularly threaten and insult them. There are roughly 7,000 people in “official” Tripoli detention centres, including 640 children, according to the UN.

Many of those currently incarcerated described the moment they came closest to freedom: a point in the Mediterranean when they thought help had come, in the form of Italian boats, only for the boats to block their way until the Libyans arrived to pull them back.

Provisional figures released by the Italian Institute for International Political Studies this week show that one in five migrants who tried to escape Libya by sea in September died or disappeared – the highest percentage recorded. Seven in 10 were caught and returned by the Libyan coastguard, while only one in 10 made it to Europe. One of the last operating private rescue ships, MSF’s Aquarius, has just lost its registration because of political pressure.

How prepared is the EU for a future surge in migrant arrivals? Read more

While the EU has been effectively treating Libya as a safe country, despite consistent reports of rapes, torture, exploitation, forced labour and physical abuse of returnees, the fighting that broke out in August exposed how untrue this was.

As refugees called me and begged for help, I contacted international organisations including the UN high commissioner for refugees (UNHCR) and the International Organization for Migration. Again and again, they said there was nothing they could do while the fighting continued. The refugees have been left on their own to fight for survival. Some have even been forced to become actors in the war, after militias pulled them out of detention centres and made them move heavy weapons or pack bullets, beating those who resisted.

It also became increasingly clear that, in some cases, the messages sent out by the UN seemed to be sugarcoating the reality on the ground. While the UNHCR claimed to have “evacuated” refugees “out of harm’s way” in a statement on 30 August, the hundreds who were moved were abandoned in a battleground days later, and starved for even longer than before. While the UN said it had distributed blankets, the refugees said they still hadn’t arrived, and when they did they were stolen by their fleeing guards.

In some centres, less than a quarter of the people from refugee-recognised countries say they have been registered with the UNHCR, despite the UN having a mandate to protect them. Some have waited as long as eight months.

Last week, the UNHCR finally admitted that it had no access to the centres and had evacuated most of its own people. “We have less than a handful of international staff that are in the country currently,” Kelly Clements, deputy high commissioner at the UNHCR, told me in New York.

A second ceasefire between Libyan militias was announced last Tuesday, though it remains to be seen if it will hold (a previous ceasefire, agreed on 4 September, lasted just a few days).

For the thousands of detainees who have escaped dictatorships or war zones, only to survive torture and abuse by smugglers, the proclamations about human rights by European politicians are total hypocrisy.

“We are losing hope, even from God,” one previously responsive refugee messaged me recently, after a long break in contact. “My mind is not working [like] before. Everything is becoming darkness.”

• Sally Hayden is a journalist focusing on migration, conflict, human rights and humanitarian crises