HOUSTON — A judge has ordered the federal government not to enforce a ban on asylum for people who cross the southern border illegally, another court setback for the Trump administration’s efforts to impose new immigration restrictions without congressional approval.

U.S. District Judge Jon Tigar agreed late Monday with legal groups that sued after President Donald Trump issued a Nov. 9 proclamation saying anyone who crossed the southern border between official ports of entry would be ineligible for asylum. The administration argued that caravans of migrants approaching the southern border made the new restrictions necessary.

“Whatever the scope of the President’s authority, he may not rewrite the immigration laws to impose a condition that Congress has expressly forbidden,” said Tigar, a nominee of former President Barack Obama.

Trump stopped family separations at the border earlier this year after a global outcry, but it was a federal judge who ruled the administration had to reunify the families. Another judge rejected the administration’s request to try to detain migrant families in long-term facilities.

Monday’s ruling remains in effect for one month, barring an appeal. In limiting asylum, Trump used the same powers he used to impose a travel ban — the third try was ultimately upheld by the Supreme Court.

A joint statement by Homeland Security and the Justice Department said the Supreme Court had already shown the president had the legal right to restrict asylum. “Our asylum system is broken, and it is being abused by tens of thousands of meritless claims every year,” the departments said.

Homeland Security Secretary Kirstjen Nielsen, speaking at a San Diego news conference, called the ruling “dangerous” and expressed confidence it would be overturned on appeal.

Trump on Tuesday criticized the 9th U.S. Circuit Court of Appeals, which would likely receive any appeal of Tigar’s order and has already ruled against the administration in several immigration cases. Trump called the circuit a “disgrace” and its judges “very unfair.”

Whether asylum seekers would try now to enter between official ports of entry was unclear.

One immigrant waiting at the official border crossing vowed to stay in line regardless of the ruling. “I’ve always taken the correct path, and I’m not going to do something illegal now,” said Byron Torrez, 28, of Nicaragua.

“I think it is good that the court did this because a lot of people cross illegally, not to break the law, but because they believe you have to get to the U.S. first before requesting asylum,” he said.

The regulations were put in place in part to stop what the government says are loopholes that allow thousands of people to avoid deportation. DHS estimates around 70,000 people a year claim asylum after crossing illegally.

Tigar’s ruling notes that federal law says someone may seek asylum if they have arrived in the United States, “whether or not at a designated port of arrival.”

Around 3,000 people from the first of the caravans have arrived in Tijuana, Mexico, across the border from San Diego.