Jonathan Rizzo did his best to survive. A 30-year-old asylum seeker from Guatemala, after his arrest at the border in May, he was crammed into a Border Patrol holding facility in Brownsville with so many other men that they had to sleep in shifts. Some stretched out on the filthy concrete floor while others stood.

One miserable night, the cell’s single toilet backed up, spilling feces and urine on the floor. The inmates were told that nothing could be done until a cleaning crew came to work the next day.

As bad as those conditions were, things got worse for Rizzo. He began to feel feverish and achy. His guards refused to give him medical treatment, he said, but he was so ill that other detainees banged on the metal cell walls demanding that Rizzo be helped. The guards relented, and he was sent to a hospital where he was diagnosed with pneumonia. After injecting him with antibiotics, hospital staff sent him back to the Border Patrol facility with medication.

When Rizzo’s 25-year-old cousin, Kevin Rizzo, later showed similar symptoms, the guards also refused to get him medical treatment. Jonathan helped his cousin by pretending to swallow his own pills and then giving them to Kevin, who eventually got well.

Jonathan Rizzo gave this hellish account of his 29-day stay in Border Patrol detention during an unusual hearing in a Brownsville federal court on Thursday. He was one of seven witnesses who testified as part of a lawsuit that seeks to establish minimum standards of health, nutrition, and access to lawyers, as well as a cap on the length of time people may be held. The migrants repeatedly testified to overcrowding, lack of access to medical care and legal assistance, demeaning treatment by guards, and filthy conditions. The cells reeked of body odor and waste, making for miserable conditions that threatened the health of the detainees. “In 52 days, I was allowed one shower and allowed to brush my teeth once,” declared Salvadoran Bryan Alexander Lopez y Lopez.

In late July, lawyers representing sixteen migrants filed a writ of habeas corpus to force immigration officials to address the inhumane conditions and lengthy detentions in what are supposed to be temporary facilities. Efren Olivares, an attorney with the Texas Civil Rights Project who is helping to represent the plaintiffs, said similar suits in the past have simply prompted immigration officials to release plaintiffs in order to get the cases dismissed. The government likewise argued for the dismissal of this suit, since ten of the sixteen plaintiffs are no longer in Border Patrol custody.

But federal district judge Fernando Rodriguez Jr., nominated to the bench by President Trump in 2017, ruled that the case should go forward. “This is a rare opportunity to hear live testimony in an open hearing about what conditions are really like in these facilities,” Olivares said.

For more than seven hours on Thursday, six of the migrant plaintiffs described horrid conditions inside hieleras, or iceboxes, a nickname given by detainees to these holding facilities because of their bitterly cold temperatures.

Even the government admitted to problems. Assistant U.S. attorney Daniel Hu called the situation a humanitarian crisis, the result of a recent unanticipated surge that overwhelmed the nation’s immigration system. He acknowledged that migrants sleep on floors and that “hygiene was limited,” but he insisted that no one was held incommunicado or denied medical attention. Another government attorney, Annalisa Cravens, said immigration records in four South Texas counties—the focal point of the writs—showed that the average time in custody is 31 hours for men and 54 hours for women, well below the 72 hours that CPB policy says detainees should be kept.

On Friday, Rodolfo Karisch, the Border Patrol chief for the Rio Grande Valley sector, testified that agents have been completely overwhelmed this year. When the Department of Homeland Security’s Office of Inspector General visited South Texas facilities in May and later released a scathing report, Border Patrol was detaining eight thousand migrants in a region that has a detention capacity of just two thousand. Each day, the agency was flying migrants to facilities as far away as San Diego to handle the volume.

The witnesses at Thursday’s hearing spoke of being held for weeks during that period, and they laid out a pattern of practices that they called demeaning. Breakfast was often limited to crackers and water. Lunch was a single bologna sandwich in which the meat was often frozen. Sandwiches they’d refused to eat at lunch would reappear as dinner. One of the migrants joked that they enjoyed days when visitors came because they were fed hot burritos.

Most of the witnesses said they went between one and two months in the facility with only a single bath or no bath at all. Several of them laughed when, on cross-examination, government lawyers asked if they received moistened wipes to clean themselves. More than one migrant said that inmates received one wet wipe and one dry to clean their entire body—and the wipes were doled out once a week. One witness said that when a toilet overflowed, he and several other migrants had their clothes soaked with the dirty water. Officials eventually fixed the toilet, cleaned the floors, and even gave them new aluminum blankets, but refused to give them new uniforms.

Others spoke of having to sleep near the toilets because there was no other space. One of the men described laying down near a toilet with an aluminum blanket wrapped around his body to avoid the splash of urine as others used the toilet.

Medical care was inadequate, the migrants said. One man testified that when he experienced chest pains in a McAllen holding facility, he was allowed to see a staff nurse who agreed that his heart appeared to be racing, but then simply gave him a laxative and sent him back to his cell. Another witness was taken to a hospital complaining of a toothache. Despite receiving treatment, the pain persisted, and guards refused further help, so he extracted the tooth himself.

All of the witnesses claimed they were denied lawyers and the ability to make phone calls. One witness said that after fifty days in a facility, a guard he perceived to be friendly agreed to let him make a phone call—but only at 5:30 a.m., so no one answered.

Perhaps the most prominent witness was eighteen-year-old Francisco Erwin Galicia, a U.S. citizen who spent 26 days in immigration custody because Border Patrol agents did not believe that his Texas driver’s license and his wallet-sized birth certificate showing he was born in Dallas were real. Galicia testified that he wasn’t allowed to call his mother and had no idea she had hired a lawyer on his behalf. The lawyer, armed with proof of citizenship for her client, was initially turned away by immigration officials with the explanation that they could not provide her with any information unless they got permission from Galicia, whom they would not confirm was even in custody.

Rodriguez said he would issue a ruling soon.