A federal appeals court has held up the bulk of a Texas law cracking down on "sanctuary cities" — cities that refuse to cooperate with federal immigration authorities.

The ruling Tuesday 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 in the country, deciding against plaintiff cities like Austin.

The Texas 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 overturned one portion of the law requiring elected officials to "endorse" the law.

Get Breaking News Delivered to Your Inbox

Texas Attorney General Ken Paxton applauded the decision in a statement.

"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," Paxton said. "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."

President Trump and Attorney General Jeff Sessions have made cracking down on "sanctuary cities" a key focus of the administration. The Justice Department recently filed a lawsuit against California, claiming the state is hindering federal enforcement of immigration laws.