The reports I'd read about these centres were grim, but seeing it first hand was even more alarming. The conditions were filthy, cramped and dangerous - among the worst I have seen in 12 years of humanitarian work. And this was one of the better-managed centres.
What I witnessed was a powerful reminder of just how urgent it is that alternatives to detention be fully implemented in Libya: to transfer women, men and children out of these centres to be registered for asylum or to be supported to return home.
Inside a walled compound in Tripoli, four huge, warehouse-like spaces were packed with people. Women and children filled two warehouses, while men stayed in the other two. There were hundreds of mattresses on the floor, covering almost every inch of space. Writing covered the inside walls, some of it in English: 'Mama I miss you', one piece of graffiti said. Another said, 'Please help us'.
There were people from Somalia, Sudan, Eritrea, and a handful of other nationalities stuck in limbo, in oppressive heat and with no shade in the shared courtyard.
In one of the warehouses, four small children stood silently together. One of the women, a migrant, explained to me that they had arrived a few days ago, 'rescued' from a boat on the Mediterranean the sea.
One of the children told me her name was Aisha. She looked about seven, and had been rescued with her brother, who couldn't have been more than ten. The two boys with them were also siblings. All four were from the Ivory Coast. None knew where their parents were.
According to the director of the detention centre there are up to 50 children under the age of 14 detained there, and perhaps another 50 babies. He estimated that there were about 300 women, perhaps 500 men.
No system in place
He could not confirm exact numbers, because there are no proper systems in place to register people.
He spoke openly about the challenges: people transferred from other detention centres, or from boats that have been intercepted by the Libyan coastguard, with little warning or paperwork; the rapid rise in numbers - from 200 in February, to close to 1,000 people when I visited, with reports of another 600 possibly arriving in the week ahead.
Numbers in detention fluctuate month by month as the two mechanisms that are in place to extract people - either to be registered as refugees by the UN refugee agency (UNHCR), or to be sent home voluntarily by the International Organization for Migration (IoM) - are not fully functional, and do not always keep pace with the numbers of new arrivals.
The process to identify and extract refugees is particularly slow; bogged down by bureaucracy and - so it seems - not seen as enough of a priority by the Libyan authorities.
The director spoke also of the lack of basic supplies and services. There is no milk or pampers for the babies. There is poor maintenance of toilet and shower facilities, insufficient supplies of basic hygiene materials like soap. The list went on.
The conditions present major risks for serious disease, like tuberculosis.
As a humanitarian organisation, the IRC is fundamentally opposed to the shocking detention system that is in place in Libya, but we also have an obligation to provide life-saving assistance to those who need it.
There are limits to what we as IRC can do, from an ethical and humanitarian standpoint: we do what we can to save lives, but under these conditions it is practically impossible to improve them.
In an ideal world, the people who I saw detained in these warehouses – and all the others caught up in this dangerous migration route, or by conflict and violence in countries like Eritrea and Sudan - would have the right to seek asylum if they wish to, and they would not be detained while awaiting the outcome of their asylum claims.
Libya does not currently offer these opportunities and conditions, of course.
However, feasible alternatives to detention that can be introduced in Libya do exist. Extensive efforts made by UN agencies and some European Union officials, diplomats and donors engaging with the Libyan authorities are finally starting to show some promise: To enable people to be rapidly evacuated from these detention centres, transferred into temporary accommodation facilities where they can be registered for asylum, or supported to return back to their countries of origin. This is urgently needed.
What I saw that day at the detention centre has stayed with me: stark images of a truly desperate humanitarian crisis, mislabelled and tragically misunderstood as a 'migration crisis'.
A new IRC report, Pushing the Boundaries, outlines a 10-point Action Plan for how these conditions and more can be improved along the so-called central Mediterranean route.
Migrants should be treated with dignity, and their rights, under international law, upheld.
European leaders who are partnering with the Libyan authorities to manage migration should make reforms to the detention system a condition of their support.
European values must be more than words on a page.