The Trump administration’s harsh immigration policies — including the forced separation of parents and children and the denial of parole to asylum-seekers without criminal records — are running into a buzzsaw in federal courtrooms across the country. Again and again, conservative and progressive judges alike are not only ruling against the government, they are breaking from their usual measured legalese to excoriate the administration for misrepresenting the current state of immigration, making promises in bad faith, and flouting both federal law and the Constitution.

These repeated legal setbacks, however, have not entirely stripped the administration of the ability to enact harsh immigration policies, including ones that will lead to future family separations and the denial of asylum to formerly eligible immigrants fleeing deadly conditions in their home countries.

A judicial pounding

Over the past few weeks, courts have ordered the Trump administration to reunite most of the families it separated, to halt deportations of those families, and to give asylum-seekers due process in their parole hearings. Judges have also rejected the administration’s attempt to roll back decades-old legal protections for migrant children.

In a scathing ruling in early July, U.S. District Judge Dolly Gee blasted the Justice Department for arguing that it needed to scrap or weaken the 1997 Flores settlement that sets minimum standards for the treatment of children in immigration detention — particularly the provision that sets a limit of 20 days for holding a child in a facility not designed for children.

“It is apparent that Defendants’ Application is a cynical attempt … to shift responsibility to the Judiciary for over 20 years of Congressional inaction and ill-considered Executive action that have led to the current stalemate,” wrote Gee, who serves in the Central District of California in Los Angeles. She went on to rake the administration over the coals for asserting without evidence that her 2015 ruling upholding Flores caused a surge in illegal immigration, and for stating untruthfully that immigrant families on supervised release “frequently fail to appear” at their court hearings, when 15 years of government data show that 86 percent of family detainees attend all of their court dates.

Gee was appointed to the federal bench by President Barack Obama, though she notably shot down a similar attempt by his administration to water down Flores and detain immigrant children for longer periods. But even conservative judges appointed by Republicans are taking the administration to task for its immigration arguments and failure to act in good faith to comply with court orders.

U.S. District Judge Dana Sabraw, who was appointed by George W. Bush, has sided repeatedly with the American Civil Liberties Union in its class action lawsuit challenging the family separation policy and ordering the government to quickly reunite the families, stop subjecting them to DNA tests indiscriminately, and halt deportations of the reunited families. Sabraw, who serves in the Southern District of California in San Diego, also rejected the administration’s arguments that it should not have to reunite parents who were deported without their children.

Sabraw began presiding over the case in a restrained and sometimes government-friendly manner. He repeatedly declined to hold the Trump administration in contempt even when it blew his deadline for reuniting all children younger than 5 by July 10 and when it ignored his order to give the ACLU notice of when and where the reunifications would take place.

Yet when the Trump administration complained in a legal filing that Sabraw was putting the separated children in danger by ordering their swift reunification with their parents, he lost all patience. First in a written order and then again in a statement from the bench, he said the administration “either does not understand the court’s orders or is acting in defiance of them,” and reiterated that the government has both the ability and the legal obligation to quickly reunite the families whose separation it caused in the first place.

“Unfortunately, HHS appears to be operating in a vacuum, entirely divorced from the undisputed circumstances of this case,” Sabraw blistered, adding that the government’s behavior “calls into question the Court’s previous statements that Defendants are acting in good faith.” At a hearing on Monday, Sabraw voiced further frustration with the government’s claim that halting deportations of reunited families would slow the reunification process.

“That’s not an option. That just shouldn’t be happening,” he said tersely. “If space is an issue, the government can make space.”

Across the country, U.S. District Judge Paul Friedman in Washington went through a similar arc while handling a lawsuit from Texas seeking the reunification of three Central American asylum-seekers whose children were taken from them. At first, Friedman held off on granting the restraining order the plaintiffs were seeking, saying he would wait and see whether the administration was acting in good faith to comply with Sabraw’s order to reunite all families, including the ones in Friedman’s case.

But after a few weeks and two court hearings, the Trump administration had only reunited one of the three families in the case, had not allowed the other two parents adequate contact with their children, and had not even informed one parent where her child was being held. On Monday, Friedman granted a temporary restraining order against the Trump administration to force those actions to take place.

Another D.C. federal judge, James Boasberg, ruled in early July that the Trump administration is violating its own rules around releasing asylum-seekers on parole, saying that the evidence against it was “irrefutable.”

Additional lawsuits are pending against the Trump administration for violating the due process rights of immigrant families, including one filed by the attorneys general of more than a dozen states. More adverse rulings may be on the way, as usually restrained and deferential federal judges look to the administration’s bad faith arguments and foot-dragging compliance in the previous cases and opt not to give it the benefit of the doubt.

The limits of the gavel

The administration’s repeated losses in court, however, have not always been a win for immigrant families.

As the Supreme Court’s consideration of Trump’s travel ban clearly demonstrated, the executive branch enjoys broad authority and deference from courts when it comes to immigration — even when the policies come from officials with a demonstrated animus toward immigrants. And while the administration’s most egregious and unconstitutional practices may be halted, a version of them may very well be allowed to stand.

In fact, in response to Sabraw’s order to reunite most separated families and to Gee’s order upholding Flores 20-day limit on detaining children, the Trump administration sought confirmation from courts to present immigrant families with the choice between indefinite family detention and separation from their children. As the administration moves to build more detention centers that can hold families, including on military bases, the Justice Department says it may begin to ask families if they would rather waive their right to be together as a family or waive their child’s Flores rights. Both federal judges and the ACLU have acknowledged that the administration can legally go forward with that plan.

Additionally, reports from legal groups on the ground say the administration is continuing to separate families in violation of the Sabraw’s order. Despite pleas from the ACLU and other advocacy groups, courts have also not yet barred the administration from charging immigrant parents for the cost of phone calls with their children, DNA tests to prove their relationship, and transportation to be reunited.

Addressing some of the issues courts have not yet touched, Sen. Kamala Harris (D-CA) introduced a bill on Tuesday that would force the administration to immediately reunite families and cover all the costs of doing so, provide them with access to legal counsel and child advocates, and restore the case management program that allowed families to be released on parole while awaiting their immigration court hearings.

In response to a recent inspector general report that infrequent and superficial inspections of ICE detention centers have allowed dangerous conditions and abuses to continue for years, the bill also mandates more audits of those facilities without prior notice.

Another bill introduced this week by Sen. Patty Murray (D-WA) would ban another of the administration’s harsh practices: the shackling of pregnant women in immigration detention.

No Republicans have cosponsored either bill, meaning they have no chance of becoming law in this GOP-controlled Congress. But immigration legislation is very likely to be on the agenda if Democrats take control of either the House or Senate this November.