AUSTIN, Texas -- A federal appeals court has upheld the bulk of a Texas law targeting "sanctuary cities" that is backed by the Trump administration as part of a crackdown on illegal immigration.

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.

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.

Republican Texas Attorney General Ken Paxton applauded the ruling with a statement saying "dangerous criminals shouldn't be allowed back into our communities" to possibly commit more crimes.