WASHINGTON (Reuters) - The White House will fight a federal judge’s decision blocking the Trump administration from enforcing a new rule that aimed to bar almost all asylum applications at the U.S.-Mexico border, it said on Thursday.

FILE PHOTO: Pedestrian walks next to the wall that is being built at the White House to facilitate the workers task modernizing the compound’s security fence along Pennsylvania Avenue in Washington, U.S. July 22, 2019. REUTERS/Jonathan Ernst

U.S. District Judge Jon Tigar in the Northern District of California issued a preliminary injunction on Wednesday blocking the rule, which would require asylum-seekers to first pursue safe haven in a third country they had traveled through on their way to the United States.

“We intend to pursue all available options to address this meritless ruling and to defend this Nation’s borders,” the White House said in a statement.

Democratic lawmakers and civil rights groups have criticized the rule as being in breach of U.S. immigration law. The United Nations High Commissioner for Refugees has said the restrictions curtail the right to seek asylum and run afoul of international legal standards.

The San Francisco court’s decision means the rule will be suspended pending further proceedings. It was not clear what steps the administration of President Donald Trump, a Republican, planned to take to fight the ruling.

Lawyers said the California ruling makes inconsequential a ruling by U.S. District Judge Timothy Kelly in Washington, D.C., made a few hours earlier on Wednesday that declined to block the rule in a different lawsuit brought by immigration advocacy groups.

The White House had praised that earlier ruling.

It complained on Thursday that plaintiffs should not be able to shop for a judge “who will purport to dictate immigration policy to the entire Nation.”

The new rule, announced July 15, required asylum-seekers to have first applied for asylum and been rejected in one of the countries they traveled through before becoming eligible to apply in the United States. The rule only applies to migrants arriving at the southern land border, effectively shifting the burden to countries such as Mexico and Guatemala to process asylum claims.

The American Civil Liberties Union and other rights groups sued to block the rule in California on the grounds it violates U.S. law that welcomes those who come to the United States fleeing persecution at home.

The asylum rule was one of a series of anti-immigration edicts issued by the Trump administration recently as it seeks to stem the flow of migrants arriving at the border with Mexico after fleeing violence and poverty in countries including Guatemala, Honduras and El Salvador. It has characterized the vast majority of their asylum claims as bogus.

A federal watchdog and Democratic lawmakers who have toured migrant detention centers near the southern border have criticized the crowded, unsanitary conditions in which asylum seekers and other migrants, including children, are being held.

An American teenager who was detained for 23 days at a center in Pearsall, Texas, after being stopped at a U.S. Customs and Border Protection (CBP) checkpoint, described desperate conditions following his release this week.

Francisco Erwin Galicia, a Texas-born U.S. citizen, told the Dallas Morning News on Wednesday that he lost 26lb (12 kg) through lack of food and that he could not shower while detained, leaving his skin dry and dirty.

“It was inhumane how they treated us,” Galicia told the newspaper. “It got to the point where I was ready to sign a deportation paper just to not be suffering there anymore.” CBP declined to comment on his account of poor conditions, the paper said.

Opponents of the asylum restrictions said the United States cannot force migrants to first apply for asylum in another country unless Washington first has a “safe third country” agreement with that government, as the United States has with Canada. Both Mexico and Guatemala have resisted Trump administration efforts to reach such a deal.