A U.S. judge on Wednesday blocked sections of a Texas law intended to punish so-called "sanctuary cities," regarded as soft on immigration, in a ruling handed down two days before the law was due to come into effect.
Chief U.S. District Judge Orlando Garcia in San Antonio's federal court found the Texas legislation was unlikely to withstand constitutional scrutiny.
The judge's ruling temporarily blocks part of the law that would require local law enforcement agencies in Texas to fulfill requests by U.S. immigration agents to hold immigrants in their jails until they can be picked up for deportation.
It also strikes down a provision that would have prevented local officials from adopting policies that might limit immigration enforcement in the state.
"The court cannot and does not second-guess the legislature,” Garcia wrote in a 94-page decision. "However, the state may not exercise its authority in a manner that violates the United States Constitution."
The decision in Texas could have ramifications nationwide as other Republican-controlled states are looking at legislation targeting sanctuary cities, which they say illegally shield immigrants.
The Texas law, which takes aim at any jurisdiction that refuses to cooperate with federal immigration authorities, is considered one of the toughest anti-illegal immigration efforts in the country.
The ruling will make Texas communities less safe, Texas Gov. Greg Abbott, a Republican, said in a statement.
"This decision will be appealed immediately and I am confident Texas' law will be found constitutional and ultimately be upheld," he added.
It was the first law of its kind passed since President Donald Trump took office in January, pledging to crack down on illegal immigration.
The American Civil Liberties Union challenged the Texas measure in a lawsuit on behalf of some local jurisdictions in the state.
"The court was right to strike down virtually all of this patently unconstitutional law," Lee Gelernt, deputy director of the ACLU's immigrant rights project, said in a statement.
The impending law added to the anxiety felt by some undocumented immigrants forced to evacuate their flooded homes in Houston after Hurricane Harvey struck southeast Texas.
Nevertheless, federal agents are not enforcing immigration law at evacuation sites, shelters, or food banks where people affected by flooding are seeking aid, U.S. Immigration and Customs Enforcement said in a statement on Wednesday.
Some police chiefs have said forcing local police to work with U.S. immigration agents undermines community trust, making immigrants less likely to report crimes.
"This week's crisis with Hurricane Harvey is just the most recent example why people need to feel safe approaching our local police and support groups, no matter what," Steve Adler, mayor of Texas' state capital Austin, said in a statement.