AUSTIN, Texas (AP)  A federal appeals court Tuesday upheld the bulk of Texas” crackdown on “sanctuary cities” in a victory for the Trump administration as part of its aggressive fight against measures seen as protecting immigrants who are in the U.S. illegally.

The ruling by a three-judge panel of the 5th U.S. Circuit Court of Appeals in New Orleans allows Texas to enforce what critics call the toughest state-level immigration measure since Arizona passed what critics called a “Show Me Your Papers” law in 2010.

The law allows police officers to ask people during routine stops whether they”re in the U.S. legally and threatens sheriffs with jail time for not cooperating with federal immigration authorities.

The ruling comes a week after the U.S. Justice Department  which had joined Texas in defending the law known as Senate Bill 4  sued California over state laws aimed at protecting immigrants.

“Dangerous criminals shouldn”t be allowed back into our communities to possibly commit more crimes,” Republican Texas Attorney General Ken Paxton said in response to the decision.

Leading the lawsuit were Texas” largest cities including Houston, Dallas, San Antonio and Austin  in a state where the Hispanic population has grown at a pace three times that of white residents since 2010.

Under the Texas law, local authorities who fail to honor federal requests to hold people jailed on offenses that aren”t immigration related for possible deportation can be fined. Police chiefs, sheriffs and constables could also now face removal from office and even criminal charges for failing to comply with such federal “detainer” requests.

Lee Gelernt, an attorney for the American Civil Liberties Union, said they were disappointed in the ruling and will closely monitor how the law is implemented. The only part of the Texas law removed by the court was a portion prohibiting local officials from “endorsing” policies that limit immigration enforcement.