HOUSTON -- A federal judge barred the Trump administration Monday from refusing asylum to immigrants who cross the southern border illegally.

U.S. District Judge Jon S. Tigar issued a temporary restraining order after hearing arguments in San Francisco. He acted on a request made by the American Civil Liberties Union and the Center for Constitutional Rights, which quickly sued after President Trump issued the ban this month in response to the caravans of migrants that have started to arrive at the U.S.-Mexico border.

Mr. Trump issued a proclamation on Nov. 9 that said anyone who crossed the southern border illegally would be ineligible for asylum. The regulations, which would have remained in place for three months absent a court order, could potentially make it harder for thousands of people who enter the U.S. to avoid deportation.

Get Breaking News Delivered to Your Inbox

"Individuals are entitled to asylum if they cross between ports of entry," said Baher Azmy, a lawyer for the Center for Constitutional Rights. "It couldn't be clearer."

When it sued, the ACLU tweeted that neither "the president nor his Cabinet can override the clear commands of our law."

But when Mr. Trump issued his proclamation, DHS Secretary Kirstjen Nielsen argued in a statement that he has "the broad authority to suspend or restrict the entry of aliens" into the U.S. if he deems it's in the national interest. She added that Congress had given the president the authority to take that action.

The president has argued that the recent caravans are a threat to national security.

Recently, tens of thousands of immigrants have shown up each year in the Arizona desert or on the northern bank of the Rio Grande River in Texas, surrendered to immigration agents and requested asylum. The Department of Homeland Security estimates around 70,000 people a year claim asylum between official ports of entry.

Around 3,000 people from the first of the caravans have arrived in Tijuana, Mexico, across the border from San Diego. U.S. Customs and Border Protection said Monday it closed off northbound traffic for several hours at the San Ysidro crossing. It has also installed movable, wire-topped barriers, apparently to stop a potential mass rush of people.

As of Monday, 107 people detained between official crossings have sought asylum since Mr. Trump's order went into effect, according to DHS, which oversees Customs and Border Protection. Officials didn't say whether those people's cases were still progressing through other avenues left to them after the proclamation.

DHS has said it wants asylum seekers at the southern border to appear at an official border crossing. But many border crossings such as San Ysidro already have long wait times. People are often forced to wait in shelters or outdoor camps on the Mexican side, sometimes for weeks.

ACLU lawyer Lee Gelernt said that some people seeking asylum cross between official ports because "they're in real danger," either in their countries of origin or in Mexico.

"We don't condone people entering between ports of entry, but Congress has made the decision that if they do, they still need to be allowed to apply for asylum," he said.

Tigar was nominated to the court by former President Obama, the Reuters news agency notes.