A federal judge in San Antonio appointed by President Bill Clinton, Orlando Garcia, has issued a temporary restraining order against portions of Texas’ new sanctuary city law.

SB 4, which was set to take effect on Sept. 1, outlawed sanctuary policies by Texas counties, cities, and municipalities.

This order is wrong on two levels: It interferes with the prerogatives of a state government, and it misinterprets federal immigration law. Texas Attorney General Ken Paxton as well as Gov. Greg Abbott (the state’s former attorney general) have already announced that they intend to appeal to the 5th U.S. Circuit Court of Appeals.

As Garcia explains, SB 4 (which applies to illegal aliens already arrested or lawfully detained) does four things. It prohibits local government entities from preventing their police officers from:

1) Checking the immigration status of criminals.

2) Notifying the federal government that they are holding criminal illegal aliens.

3) Assisting or cooperating with federal immigration officers (including honoring detainer warrants on illegal aliens issued by federal authorities).

4) Permitting federal immigration officers to enter local jails and conducting investigations of criminal illegal aliens.

The penalties for violating SB 4 range from civil fines to criminal punishment.

In a 94-page opinion released Wednesday, Garcia refused to enjoin the first and second portions of the law. However, he stopped enforcement of the other provisions based on erroneous reasoning, ignoring the fact that state governments, unlike the federal government, have enormous power over local municipalities—including the power to dissolve them.

As the Supreme Court observed in 1907 in Hunter v. Pittsburgh, the “number, nature, and duration of the powers conferred upon [municipal] corporations and the territory over which they shall be exercised rests in the absolute discretion of the state.”

Garcia was handicapped from enjoining the first and second provisions of SB 4 because they are similar to a law that Arizona passed back in 2010, to the great consternation of the Obama administration, which sued Arizona.

That case went all the way to the Supreme Court, which in 2012 in Arizona v. U.S., upheld the ability of states to require that the immigration status of criminals be checked and the federal government notified when local law enforcement officials are holding an illegal alien arrested for violating a local or state law.

The judge did temporarily enjoin the third and fourth provisions of SB 4 by totally misinterpreting federal law.

In order to encourage local jurisdictions to assist the federal government in enforcing immigration law, Congress added a section to federal immigration law, popularly known as the 287(g) program, which is codified at 8 U.S.C. §1357.

This allows the attorney general to enter into written agreements with local law enforcement authorities to provide them with both money and training in immigration enforcement.

The 287(g) program wasn’t intended to provide the exclusive means for local officials to help the federal government in immigration enforcement. It was simply meant to encourage more jurisdictions to do so by providing training and federal money.

The Obama administration hated this program so much it did everything it could to end it.

Yet Garcia illogically (or intentionally) misreads this statute to hold that local and state officials cannot assist or cooperate with federal immigration authorities in enforcement activities unless they meet all of the “exacting requirements” of the 287(g) program and its authorizing federal statute.

He does this despite the plain language of the statute that specifically states that this provision shall not “be construed to require an agreement” in order for state or local officials to “communicate with the attorney general regarding the immigration status of any individual, including reporting knowledge that a particular alien is not lawfully present in the United States; or (B) otherwise to cooperate with the Attorney General in the identification, apprehension, detention, or removal of aliens not lawfully present in the U.S.”

Another odd argument the judge makes is that the Texas statute violates the First Amendment because it contains a provision that says that local jurisdictions cannot “adopt, enforce, or endorse” a sanctuary policy. Garcia claims the word “endorse” is vague and overbroad.

But as Texas points out in the motion for a stay that it has already filed, a simple review of a dictionary shows that the word “endorse” means to “sanction,” and sanction means to ratify, authorize, or permit.

The language of SB 4 makes it obvious that it is intended to “stop local law enforcement agencies from having policies that obstruct cooperation with federal immigration officials.” This resolves any claim that the word “endorse” is “vague.”

The judge also found that requiring local law enforcement to honor detainer warrants violates the Fourth Amendment.

Detainer warrants are issued by the Department of Homeland Security for illegal aliens who are legally removable from the country and filed with local law enforcement officials, asking them to hold the illegal aliens for 48 hours so they can be picked up by federal authorities.

But as Texas says in its stay motion, “if the Constitution allows Congress to authorize federal immigration officials to take aliens into custody based on civil removability grounds, then it makes no difference for Fourth Amendment purposes whether state officials carry out the first 48 hours of that detention at the behest of the federal government.”

In other words, since federal authorities have the power to detain illegal aliens, “the fact that state officials are doing so at the direct request of federal officials” is irrelevant to the Fourth Amendment.

Texas is sure to appeal, and it should. Garcia’s decision not only interferes with the inherent police powers of state governments and their absolute authority over their political subdivisions, it severely misreads federal immigration law.

As the governor himself said, Garcia’s “decision makes Texas communities less safe. … [G]ang members and dangerous criminals … will be set free to prey upon our communities.”