A California federal judge ruled that the Obama administration's detention of children and their mothers who were caught crossing the border illegally is a violation of a previous court settlement and that the families should be released as quickly as possible.

The Obama-appointed Judge Dolly M. Gee of federal district court for the Central District of California ruled on Friday against the administration. She found that two detention centers in Texas, which opened last summer, fail to meet minimum legal requirements of a 1997 settlement for facilities housing children, reported The New York Times.

She stated in her opinion that illegal immigrant children had been held in "widespread deplorable conditions" in Border Control stations after they were caught and that their temporary cells failed to provide "safe and sanitary" conditions.

Gee's opinion was a significant setback for Homeland Security Secretary Jeh Johnson, who was desperate to respond to the surge of illegal immigrant children flooding the border last summer.

“We are disappointed with the court’s decision and are reviewing it in consultation with the Department of Justice,” a spokeswoman for the Department of Homeland Security told the Times. DHS officials said they would respond to an order by the judge to present a plan by Aug. 3 for carrying out the ruling.

The judge's opinion expands a previously held class action lawsuit, known as Flores, that has governed the treatment of unaccompanied minors apprehended at the border. Gee's ruling mandates that the Flores settlement include children caught with their parents.

Liberal groups are celebrating the decision.

“I think this spells the beginning of the end for the Obama administration’s immigrant family detention policy,” Peter Schey, the president of the Center for Human Rights, and Constitutional Law in Los Angeles, said. “ A policy that just targets mothers with children is not rational and it’s inhumane.”

Even the limited action taken by the Obama administration to secure the border and send a message out to Central Americans who considered illegally crossing into the United States has been subverted by the courts.

Gee has made it clear that the U.S. won't secure the border even when it wants to.