Texas wanted a judge to pre-emptively approve its anti-sanctuary city law. It didn't work

The state of Texas passed a bill to restrict sanctuary cities.

(CNN)Earlier this summer, Texas passed a law banning sanctuary cities. To guard itself against potential lawsuits, the state quickly went to court to get it declared constitutional before the law was even implemented.

But the pre-emptive effort backfired when, on Wednesday, a federal judge in Austin tossed the suit.
US District Judge Sam Sparks, appointed under Republican President George H.W. Bush, didn't rule on the legality of the measure. Instead, he said the state was acting prematurely.
The law doesn't go into effect until September 1.
    "Because SB 4 does not take effect until September 1, 2017, it is impossible for defendants to take any action that would violate the not-yet-effective law," the ruling said.

    A first-of-its-kind law

    The Texas law is the first of its kind in the nation to be signed since President Donald Trump signed an executive order cracking down on sanctuary cities.
    "Sanctuary city" is a broad term applied to jurisdictions that have policies that state they won't blindly cooperate with federal law enforcement on immigration policies. Many of the largest cities in the country have forms of such policies.
    The Texas law slaps local governments with criminal and civil penalties if they don't comply with immigration law and detention requests. Police chiefs can be jailed. Officers can ask about a detainee's immigration status. Local governments can be fined up to $25,500 for each day they violate the law.
    Hours after Senate Bill 4 was signed into law, Texas Attorney General Ken Paxton went to court. The state wanted the judge's blessing that the law is constitutional to prevent it from challenges.

    A win for those against the law

    The judge's ruling on Wednesday is a win for those who have been fighting the law.
    "Attorney General Ken Paxton's case was clearly a shameful attempt to intimidate those who are speaking out about Senate Bill 4," said Austin City Council Member Greg Casar.
    The judge's dismissal of the case was expected, he said, adding the law violates the constitutional rights of all Texans.

    The next front in the fight

    The attorney general vowed to continue fighting for SB 4. The state also has to contend with a separate federal lawsuit that several jurisdictions have filed to block the law.
    Austin is among them, as are several other large cities, such as Dallas and Houston.
    "The health, safety and welfare of Texans is not negotiable," Paxton said in a statement. "We're disappointed with the court's ruling and look forward to pressing our winning arguments in the San Antonio cases and beyond (if necessary) on this undoubtedly constitutional law."
    Casar said his city, along with the others that oppose the law, will also keep fighting.
    "I think you will continue to see us try to do whatever it is we can to make sure immigrants are policed fairly," Casar said.