Los Angeles (AFP) – A US federal judge on Monday blocked President Donald Trump’s policy of returning asylum seekers to Mexico to wait out the processing of their cases, saying the Department of Homeland Security had overstepped its authority.

The ruling by US District Judge Richard Seeborg in San Francisco marked a rebuke for the Trump administration’s efforts to stop the flow of migrants seeking asylum through the US border with Mexico.

The decision, which goes into effect on Friday, comes just days after outgoing Homeland Security Secretary Kirstjen Nielsen had vowed to expand the controversial program.

Several hundred people seeking asylum have been returned to Mexico to await the outcome of their request under the policy first implemented in January at the San Ysidro port of entry in California and later extended to Calexico, a second California border point, and El Paso, Texas.

“A 9th Circuit Judge just ruled that Mexico is too dangerous for migrants. So unfair to the U.S. OUT OF CONTROL!,” Trump furiously tweeted. 

While any appeal against Seeborg’s ruling will be heard by the federal Ninth Circuit appeals court — a frequent target of Trump’s ire — Seeborg himself is not on the circuit.

Elsewhere, rights groups welcomed the ruling, saying the return policy failed to provide adequate safeguards to protect asylum seekers from persecution.

“Try as it may, the Trump administration cannot simply ignore our laws in order to accomplish its goal of preventing people from seeking asylum in the United States,” said Judy Rabinovitz, deputy director of the American Civil Liberties Union’s Immigrants’ Rights Project. 

The ACLU and several other groups, including the Southern Poverty Law Center, had sought an injunction against the policy on behalf of 11 asylum seekers from El Salvador, Honduras and Guatemala who were returned to Mexico after seeking asylum at the US border.

In his 27-page ruling — which can be appealed — Seeborg said at issue was not whether the policy is “a wise, intelligent, or humane policy” but rather whether it exposes aliens to “unduly dangerous circumstances.”

He noted that the plaintiffs in the case were not challenging the “system” of expedited removal.

Trump, who originally dubbed the measure the “Remain in Mexico” policy, unveiled it last year as a series of caravans with thousands of Central American migrants made their way to the US-Mexican border.

Mexico said it was cooperating with US authorities concerning the migrants being sent back, but only for humanitarian reasons.

Migrants who reach US soil have a legal right to seek asylum and are usually held in detention facilities while their application is processed, or released into the United States.