Detained migrant children must have access to soap and toothpaste, and cannot be deprived of sleep, a panel of federal judges ruled Thursday.

The Ninth Circuit Court of Appeals dismissed a federal government appeal, which was the subject of a now-infamous hearing in which a government attorney argued that the requirement that children be afforded "safe and sanitary" conditions did not necessarily mean they needed to be given basic hygiene products. The government had appealed a 2017 decision by a lower court judge that a landmark 1997 settlement called the Flores Agreement required those items even though it did not explicitly list them.

During a June hearing, Justice Department lawyer Sarah Fabian argued that the Flores Agreement — which set a nationwide standard for the treatment of migrant children in custody — was vague and therefore, "it was left to the agencies to determine" what sanitation protocols to follow.

Get Breaking News Delivered to Your Inbox

The judges appeared incredulous during the hearing.

"It's within everybody's common understanding: If you don't have a toothbrush, if you don't have soap, if you don't have a blanket, it's not safe and sanitary. Wouldn't everybody agree to that? Do you agree to that?" Judge Wallace Tashima asked Fabian.

Justice Department lawyer Sarah Fabian at a hearing on immigrant children in June 2019. 9TH CIRCUIT COURT OF APPEALS

Another member of the panel, Judge Marsha Berzon, grilled Fabian on the sleeping conditions for children spending the night on concrete floors in crowded, frigid, brightly-lit cells.

"You're really going stand up and tell us that being able to sleep isn't a question of safe and sanitary conditions?" asked Berzon, who wrote the court's dismissal.

In the ruling, she wrote: "Those determinations reflect a commonsense understanding of what the quoted language requires. Assuring that children eat enough edible food, drink clean water, are housed in hygienic facilities with sanitary bathrooms, have soap and toothpaste, and are not sleep deprived are without doubt essential to the children's safety."