About 3,000 members of the caravan have so far arrived in Tijuana

A US federal judge has blocked an order issued by President Trump to deny the possibility of asylum to migrants crossing the southern border illegally.

US District Judge Jon Tigar in San Francisco issued the temporary restraining order after hearing arguments by civil rights groups.

Mr Trump signed the order earlier this month as thousands of migrants made their way towards the US border.

He cited national interest concerns but was opposed by civil rights group.

Migrants from across Central America have been travelling north for weeks towards the US-Mexico border. Mr Trump has described the group as a “large caravan of people”.

They say they are fleeing persecution, poverty and violence in their home countries of Honduras, Guatemala and El Salvador.

In the run-up to the US mid-term elections, President Trump said many of the migrants were criminals, called the caravan an invasion, and ordered troops to the border. He also repeatedly suggested it was politically motivated.

Department of Homeland Security spokeswoman Katie Waldman and Justice Department spokesman Steven Stafford called the asylum system “broken” in a joint statement, noting their departments will continue “to defend” the policy.

They said the current system is “being abused by tens of thousands of meritless claims every year”, and supported Mr Trump’s actions as “legitimate and well-reasoned”.

“It is absurd that a set of advocacy groups can be found to have standing to sue to stop the entire federal government from acting so that illegal aliens can receive a government benefit to which they are not entitled.”

What did the judge say?

Judge Tigar, in his ruling, said current legislation made it clear that any foreigner arriving in the US “whether or not at a designated port of arrival” could apply for asylum.

He said Mr Trump’s proclamation on 9 November was an “extreme departure” from prior practice.

“Whatever the scope of the president’s authority, he may not rewrite the immigration laws to impose a condition that Congress has expressly forbidden,” Judge Tigar added.

He was responding in a case brought by the American Civil Liberties Union (ACLU), the Southern Poverty Law Center and the Center for Constitutional Rights.

They argued that Mr Trump’s ruling was illegal.

The judge’s restraining order comes into immediate effect and remains in place until a court hearing in December to decide on the case.

What is President Trump’s order?

The proclamation on 9 November says that anyone who wants to claim asylum in the US has to come in through official points of entry – and their cases will not be heard if they enter illegally.

The ban was to last 90 days or until the US reached an agreement with Mexico to turn back asylum-seekers.

Under US law, there is a legal obligation to hear asylum claims from migrants if they say they fear violence in their home countries – regardless of how they have entered the country.

But the Trump administration invoked the same executive power he used to justify his travel ban on people from several Muslim-majority nations last year.

It said the president had the power to “suspend the entry of all aliens” and to impose “any restrictions he may deem to be appropriate on them” if they were judged to be “detrimental” to US interests under the Immigration and Nationality Act.

A statement at the time said: “We are using the authority granted to us by Congress to bar aliens who violate a presidential suspension of entry or other restriction from asylum eligibility.”

There has been no response yet to the San Francisco ruling.