LOS ANGELES — In a scathing ruling late Monday, a U.S. District Court judge here rejected the Trump administration's request to detain migrant families at the border for as long as it takes to adjudicate their cases.

In rejecting the request by President Donald Trump's Justice Department to modify the so-called Flores agreement of 1997, which dictates a 20-day maximum detention period for children caught at the border, Judge Dolly M. Gee said the government was bound by the deal.

Calling the DOJ's legal maneuvers a "cynical attempt" to shift responsibility for immigration policy to the judiciary, Gee said nothing is preventing the administration from "reconsidering their current blanket policy of family detention."

The administration's argument that parents won't show up to court if they're released "does not support a blanket non-release policy," Gee wrote in a sharply-worded ruling.

The DOJ, however, interpreted the ruling to mean it can continue business as usual at the border.

Justice Department spokesman Devin O'Malley said in a statement that the department was weighing its options. But the ruling means the government can still keep families detained, he said.

" ... The court does appear to acknowledge that parents who cross the border will not be released and must choose between remaining in family custody with their children pending immigration proceedings or requesting separation from their children so the child may be placed with a sponsor," O'Malley said.

“The Trump Administration continues to make good faith efforts that allow us to not only enforce the law, address the crisis of illegal immigration our border, and protect our nation and its citizens, but also protect the safety of children in government care and custody," he said. "We disagree with the court’s ruling declining to amend the Flores Agreement to recognize the current crisis of families making the dangerous and unlawful journey across our southern border ... "

In asking last month that Flores be modified, the DOJ said it had no choice but to keep families detained "during the pendency of immigration proceedings," according to a filing in Los Angeles.

But Gee refuted the administration's arguments, noting for example, that "86 percent of family detainees" who had been released "attended all of their court hearings."

Legal experts contend that the government will have little choice but to release families detained for allegedly crossing the border without authorization.

"Since the families aren’t supposed to be separated and children are bound by Flores settlement, it’s going to require bonding out for entire families or some type of consented stay in family detention," said immigration expert Kevin Johnson of the University of California, Davis School of Law.

A ruling June 26 by a federal judge in San Diego ordered immigration authorities to reunite children and parents detained and separated at the border. Taken together with Monday's decision, the edicts would appear to hasten the release of a class of mostly Central American migrants represented by more than 3,000 children taken from parents at the border since May.

"Their real goal is to keep families locked up for a long time, and the law doesn’t really allow that," said ACLU Immigrants' Rights Project attorney Stephen Kang.

Children traveling with parents who made asylum claims at U.S. ports of entry were often released together with their mothers and fathers as a result of Flores, a civil claim against the government filed on behalf of Jenny Lisette Flores after she was detained for two months and subjected to strip searches because she allegedly entered the United States illegally in 1985.

But the Trump administration in May instituted a "zero tolerance" policy for anyone attempting to cross the border without authorization, even if they had possible legitimate claims to asylum. Many of the migrants are fleeing violence in Central America. The Trump administration policy meant that children were taken from detained parents and put in nonprofit childcare facilities and government facilities.

Following widespread criticism, Trump issued an executive order June 20 ending the separations. But on June 21 the administration filed a request for relief in Flores. On June 29, it updated its request with a "notice of compliance" that argues the ruling out of San Diego gave the government no choice but to detain families whole.

Gee's ruling comes the same day as a federal judge in a separate case agreed to extend Tuesday's deadline for the government to complete the reunification 102 migrant childrenunder the age of 5 who were separated from their parents under Trump's "zero tolerance" policy.

The Trump administration can appeal Monday's ruling in Los Angeles to the 9th U.S. Circuit Court of Appeals. It can also ask the original plaintiff in Flores, represented by the Center for Human Rights & Constitutional Law, to reconsider its settlement with the government that limited child detentions to 20 days.

"Regardless, what is certain is that the children who are the beneficiaries of the Flores Agreement’s protections and who are now in Defendants’ custody are blameless," Gee wrote. "They are subject to the decisions made by adults over whom they have no control. In implementing the Agreement, their best interests should be paramount."