A federal appeals court ruled Tuesday that most of Texas's law targeting so-called sanctuary cities can remain in effect, a win for Republicans in the state as well as for the Trump administration as it battles measures viewed as protecting immigrants in the country illegally.

The ruling from a three-judge panel of the 5th Circuit U.S. Court of Appeals allows Texas to enforce measures outlined in Senate Bill 4, which lets local law enforcement officials ask the people they detain about their immigration status, according to The Associated Press.

The law also punishes local government officials who refuse to cooperate when federal immigration agents request that immigrants in custody be turned over to them.

The part of the law that the court said is still on hold concerns a provision that punishes local officials who “endorse” policies that restrain the enforcement of federal immigration laws.

ADVERTISEMENT

The ruling is largely seen as a victory for Gov. Greg Abbott (R) and Republicans who support the legislation.

“I’m pleased the 5th Circuit recognized that Senate Bill 4 is lawful, constitutional and protects the safety of law enforcement officers and all Texans,” Texas Attorney General Ken Paxton (R) said in a statement. “Enforcing immigration law prevents the release of individuals from custody who have been charged with serious crimes. Dangerous criminals shouldn’t be allowed back into our communities to possibly commit more crimes.”

Republicans have pushed to crack down on sanctuary cities that refuse to help officials with federal immigration enforcement, while several local governments pushed to stop the measure, including Austin, Houston and San Antonio.

Lee Gelernt, the deputy director for the American Civil Liberties Union’s Immigrant’s Rights Project, said the organization was disappointed in the ruling but would closely monitor how it is implemented.

“We are exploring all legal options going forward. The court made clear that we remain free to challenge the manner in which the law is implemented, so we will be monitoring the situation on the ground closely,” Gelernt said. “We are also pleased that the court narrowed the law in certain respects and accepted Texas’ critical concession that localities are free to decline ICE requests for assistance to preserve local resources."

A federal judge had blocked several parts of the law in August, but not the part that allowed law enforcement to question a person’s immigration status.

A separate panel of three appellate judges ruled in September that the provision that allowed local law enforcement to turn over immigrants to federal immigration officials could stand until a final decision was made. It also ruled that law enforcement could not be prevented from assisting federal immigration officers.