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

US District Judge Jon S Tigar issued a temporary restraining order after hearing arguments in San Francisco.

The request was made by the American Civil Liberties Union (ACLU) and the Centre for Constitutional Rights, which quickly sued after President Donald Trump issued the ban this month in response to the caravans of migrants that have started to arrive at the US-Mexico border.

Mr Trump issued a proclamation on November 9 that said anyone who crossed the southern border would be ineligible for asylum.

Migrant Caravan
Cars line up to cross into the United States from Tijuana, Mexico (Gregory Bull/AP)

The regulations, which will remain in place for three months absent a court order, could potentially make it harder for thousands of people who enter the US to avoid deportation.

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

In recent years, tens of thousands of immigrants each year have shown up in the Arizona desert or on the north bank of the Rio Grande in Texas, surrendered to immigration agents and requested asylum.

The Department of Homeland Security (DHS) estimates around 70,000 people a year claim asylum between official ports of entry.

Mr Trump has argued that the recent caravans are a threat to national security.

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

US Customs and Border Protection said on Monday that 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.

Central America Migrant Caravan
Newly placed barbed wire hangs at the US border fence in San Ysidro (Marco Ugarte/AP)

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.