OAKLAND, Calif. (AP) — A U.S. judge in California on Monday reinstated a nationwide halt on the Trump administration’s plan to prevent most migrants from seeking asylum at the U.S.-Mexico border.

U.S. District Judge Jon Tigar ruled in Oakland that an injunction blocking the administration’s policy from taking effect should apply nationwide.

Tigar blocked the policy in July after a lawsuit by groups that help asylum seekers. But the 9th U.S. Circuit Court of Appeals limited the impact of Tigar’s injunction to states within the area overseen by the appeals court.

That meant the policy was blocked in the border states of California and Arizona but not in New Mexico and Texas.

In his ruling, Tigar stressed a “need to maintain uniform immigration policy” and found that nonprofit organizations such as Al Otro Lado don’t know where asylum seekers who enter the U.S. will end up living and making their case to remain in the country.

“The court recognized there is grave danger facing asylum-seekers along the entire stretch of the southern border,” Lee Gelernt, an attorney for the American Civil Liberties Union, said in a statement.

Trump said he disagreed with the judge’s ruling.

“I think it’s very unfair that he does that,” Trump told reporters as he departed the White House for a trip to North Carolina. “I don’t think it should be allowed.”

White House Press Secretary Stephanie Grisham said in a statement that a sole judge shouldn’t have the ability to exert such a broad impact on immigration policy, and noted the administration’s request to the Supreme Court to set aside the injunction is still pending.

“This ruling is a gift to human smugglers and traffickers and undermines the rule of law,” she said.

The courts have halted some of Trump’s key policy shifts on immigration, including an earlier version of an asylum ban. The president has prevailed on several fronts after initial legal setbacks, for example, when the Supreme Court recently lifted a freeze on using Pentagon money to build border walls.

The rules issued by the Trump administration in July apply to most migrants who pass through another country before reaching the United States. They target tens of thousands of Central Americans fleeing violence and poverty who cross Mexico each month to seek asylum and would affect asylum seekers from Africa, Asia and South America who arrive regularly at the southern border.

The shift reversed decades of U.S. policy in what Trump administration officials said was an attempt to close the gap between an initial asylum screening that most people pass and a final decision on asylum that most people do not win.

U.S. law allows refugees to request asylum when they get to the U.S. regardless of how they arrive or cross. The crucial exception is for those who have come through a country considered to be “safe,” but the law is vague on how a country is determined to be safe. It says pursuant to a bilateral or multilateral agreement.

People are generally eligible for asylum in the U.S. if they fear return to their home country because they would be persecuted based on race, religion, nationality or membership in a particular social group.

The Border Patrol apprehended about 50,000 people at the southern border in August, a 30 percent drop in arrests from July amid summer heat and an aggressive crackdown on both sides of the border to deter migrants.

___

Associated Press writers Elliot Spagat in San Diego and Darlene Superville in Washington contributed to this report.