The Ninth U.S. Circuit Court of Appeals, in a rejection of the Trump administration’s bid to limit accommodations for immigrant children detained at the border, ruled Thursday that the children must be given adequate food, clean water, soap, and toothpaste.

A three-judge panel from the left-leaning court tossed out the U.S. government's challenge to a lower court ruling that stated authorities had failed to provide safe and sanitary conditions for the children in line with a 1997 settlement.

The settlement, known commonly as the Flores Agreement, stated that migrant children – whether accompanied by their families or not – could not be held for longer than 20 days.

U.S. District Court Judge Dolly Gee ruled in 2017 that officials had breached the settlement after young immigrants detained at the border said they had to sleep in cold, overcrowded cells and were given inadequate food and dirty water.

TRUMP ADMINISTRATION BOOSTS ABILITY TO DENY GREEN CARDS TO IMMIGRANTS USING WELFARE PROGRAMS

At a June hearing, a U.S. government lawyer argued that officials weren't required to provide specific accommodations, such as soap, under the agreement's requirement that facilities be "safe and sanitary. The appellate judges disagreed.

"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," the panel wrote.

CLICK HERE TO GET THE FOX NEWS APP

The issues at border detention have dated back years, but have drawn increased attention as the result of an ongoing rise in the number of children and families, mostly from Central America, arriving on the southwest border.

The Associated Press contributed to this report.