In a resounding victory for the State of Texas, the Fifth Circuit U.S. Court of Appeals has thrown out almost all of a preliminary injunction issued by a lower court that was preventing the Lone Star State from enforcing a state law going after sanctuary cities such as Austin, the state’s capital.

This is the right result, both legally and morally. Not only does the state law not violate the Constitution, as was erroneously claimed, but it’s intended to prevent the state from becoming a sanctuary – a safe haven – for criminal aliens who endanger the public.

Texas certainly has a right to be concerned about aliens who commit crimes in the state. The Texas Department of Public Safety recently released a report on the 245,000 criminal aliens who had been booked into local Texas jails from 2011 through the end of February of this year. Those criminal aliens, 66 percent of whom were in the country illegally, were charged with more than 650,000 criminal offenses. They have been convicted of almost 600 murders; 30,000 assaults; 3,300 sexual assaults; 9,000 burglaries; 20,000 thefts; 38,000 drug crimes; and 274 kidnappings.

As U.S. Attorney General Jeff Sessions said in a recent speech, the policies of sanctuary cities and states make no sense. The fact that these aliens were arrested for committing local crimes shows that these jurisdictions found these aliens “dangerous enough to detain them in the first place, but then insist on releasing them back into the community instead of allowing federal officers to remove them,” as Sessions noted. That is reckless behavior by public officials.

As Texas Attorney General Ken Paxton said after the ruling, sanctuary policies allow “dangerous criminals…back into our communities to possibly commit more crimes.” He is right.

To stop Texas from becoming a sanctuary for criminal aliens, the state legislature passed a law last year that required local governments to comply with federal immigration law. That included 8 U.S.C. §1373, which forbids state and local governments from preventing their officials from sending information to the federal government on illegal aliens who have been arrested or otherwise detained.

In fact, the state law requires city and county officials to assist federal immigration agents in their enforcement efforts and most importantly, to “comply with, honor, and fulfill” any detainer requests made by the federal government.

That means that local sheriffs and city police departments that fail to honor federal detainer warrants – which are requests issued by federal immigration authorities to hold illegal aliens for pickup – are in violation of state law.

The Texas statute imposes a civil penalty on sanctuary cities of up to $25,500 for each day they intentionally violate the law. Texas law enforcement officials can also be charged with a criminal misdemeanor for failing to honor detainer warrants, and the state attorney general can file a petition with a state court to remove them from office.

Unfortunately, only two days before the law was scheduled to take effect on Sept. 1, 2017, a federal judge issued a preliminary injunction stopping Texas from enforcing the most important provisions of the law based on a misinterpretation of federal immigration law and constitutional requirements. That mistake has now been corrected by a three-judge panel of the Fifth Circuit. In an 18-page opinion written by Judge Edith Jones, the panel dissolved all of the injunction except for one minor (and unimportant) provision.

Jones pointed out that with only one exception, the provisions of the Texas law “do not, on their face, violate the Constitution.” The only provision that does is one that says that local officials may not “endorse a policy” that limits enforcement of immigration laws. This amounts to a First Amendment violation since it prohibits “core political speech” by attempting to prevent officials from endorsing, i.e., speaking positively about, sanctuary policies.

The fact that the Fifth Circuit left this portion of the injunction in place is immaterial. The major, substantive parts of the Texas law that force local officials to cooperate with and assist federal immigration agents and to turn over criminal and other aliens to federal authorities is now in effect in Texas. So are the civil and criminal penalties that the state can impose on any local cities or officials who violate the law.

As Texas Attorney General Ken Paxton said after the ruling by the Fifth Circuit on Tuesday, the Texas law is “a common sense measure” intended to prevent “the release of individuals from custody who have been charged with serious crimes.” Sanctuary policies allow “dangerous criminals…back into our communities to possibly commit more crimes.” He is right.