Ben Terrall holds a protest sign that reads "Close The Camps" outside of the San Francisco Federal Courthouse on Wednesday, July 24, 2019 in San Francisco, Calif. A federal judge said Wednesday that the Trump administration can enforce its new restrictions on asylum for people crossing the U.S.-Mexico border while lawsuits challenging the policy play out. (AP Photo/Haven Daley)

Ben Terrall holds a protest sign that reads "Close The Camps" outside of the San Francisco Federal Courthouse on Wednesday, July 24, 2019 in San Francisco, Calif. A federal judge said Wednesday that the Trump administration can enforce its new restrictions on asylum for people crossing the U.S.-Mexico border while lawsuits challenging the policy play out. (AP Photo/Haven Daley)

A federal judge has ordered the Trump administration to stop denying asylum to anyone who transits through another country to reach the U.S. border, marking the latest legal defeat for a president waging an all-out battle to stem the flow of migrants entering from Mexico.

The ruling by U.S. District Judge Jon Tigar in San Francisco on Wednesday came hours after another federal judge in Washington, D.C., let the 9-day-old policy stand. The California judge’s preliminary injunction halts the policy while the lawsuit plays out in court.

The new policy denies asylum to anyone who passes through another country on the way to the U.S. without seeking protection there. Most crossing the Mexican border are from Central America, but it would apply to all nationalities except countries that border the U.S.

ADVERTISEMENT

The dramatic change went into effect last week, though there were conflicting reports on whether U.S. immigration agencies were enforcing it.

Top U.S. officials said the policy would discourage migrants from leaving their countries, which they say is necessary to reduce the numbers of people that U.S. authorities are detaining.

The White House condemned the judge’s order, calling it “tyranny of a dysfunctional system.”

White House press secretary Stephanie Grisham said Thursday the plaintiffs in the case had found “a single district judge who will purport to dictate immigration policy to the entire Nation.” She said President Donald Trump will “pursue all available options to address this meritless ruling and to defend this Nation’s borders.”

Tigar, who was appointed by former President Barack Obama, halted another Trump policy last year to deny asylum to people who crossed the border illegally.

The judge said the policy could expose migrants to violence and abuse, deny their rights under international law and return them to countries they were fleeing. He cited the administration’s own court filings to argue that Mexico was unsafe.

Tigar acknowledged that the U.S. immigration system is overwhelmed by the surge in migrants from Central America over the last year.

“But shortcutting the law, or weakening the boundary between Congress and the Executive, are not the solutions to these problems,” he wrote.

Trump told reporters before his departure for a fundraiser in West Virginia on Wednesday that the decision earlier Wednesday by U.S. District Judge Timothy Kelly, a Trump appointee, was a “tremendous ruling.” He added: “We appreciate it. We respect the courts very much. That helps us very much at the border.”

The California judge ruled in favor of advocacy groups represented by the American Civil Liberties Union, the Southern Poverty Law Center and the Center for Constitutional Rights.

Melissa Crow, an attorney for the Southern Poverty Law Center, said the decision was “an important victory for incredibly vulnerable individuals and families from besieged Central American countries seeking refuge in our country.”

ADVERTISEMENT

“We will continue to fight this draconian policy as well as the myriad of others through which the Trump administration continues to wage war on asylum-seekers and our nation’s asylum system,” Crow said.

The policy would have limited exceptions that would allow for asylum: if someone has been trafficked, if an asylum seeker sought protection in a country but was denied or if the country the migrant passed through did not sign one of the major international treaties that govern how refugees are managed, though most Western countries have signed them.

The decision came as tens of thousands of people are waiting in Mexico on official and unofficial lists formed after U.S. agents started turning away many asylum seekers, citing lack of space and delays in immigration courts. They also include people are forced to wait in Mexico while their cases wind through U.S. immigration policy, another Trump policy that has so far survived a legal challenge.

Tigar’s ruling is the latest example of courts dealing Trump a setback on immigration policy. A court stopped the administration from detaining asylum seekers without giving them a chance to be released on bond.

A judge in Oakland, California, prevented the Trump administration from tapping $2.5 billion in Pentagon money to build border walls. The administration has appealed that decision to the U.S. Supreme Court and asked for a ruling by Friday.

___

Taxin reported from Santa Ana, California, and Khalil reported from Washington. Associated Press writers Elliot Spagat in San Diego, Colleen Long in Washington and Nomaan Merchant in Houston contributed to this report.