Editor's note: This story has been updated throughout.

U.S. District Judge Sam Sparks on Wednesday dismissed the state of Texas’ lawsuit against Travis County and other defendants over the state's new immigration enforcement law.

Attorney General Ken Paxton filed a pre-emptive lawsuit shortly after the bill was signed in May seeking a ruling that the controversial measure is constitutional. Among the defendants named in Paxton's suit were the city of Austin; Travis County and its sheriff, Sally Hernandez; and the Mexican American Legal Defense and Educational Fund.

The law, known as Senate Bill 4, bans “sanctuary cities,” the common term for local governments that do not enforce federal immigration laws. The law also allows local law enforcement officers to question the immigration status of people they detain or arrest. It will take effect Sept. 1 unless a judge in a separate case out of San Antonio intervenes.

The Texas Tribune thanks its sponsors. Become one.

The law was passed in April, and Gov. Greg Abbott signed it in May after he designated the legislation an emergency item needed to ensure Texans were safe from undocumented immigrants that commit crimes.

But opponents of the measure, including the cities of Houston, Austin, San Antonio and El Cenizo, as well as Maverick and El Paso counties, have argued the law violates several provisions of the U.S. Constitution. Those entities filed a separate lawsuit against Abbott and Paxton in San Antonio, trying to prevent the law from taking effect. Oral arguments in that case were heard in June.

Sparks’ ruling means the case will stay in San Antonio. 

In a statement, the attorney general said he was disappointed in Sparks' ruling but that Wednesday's decision has no effect on the San Antonio case.

"We were first to file a lawsuit concerning SB 4, filed this case in the only proper court, and moved quickly to consolidate other lawsuits against SB 4 in Austin,” he said. "The health, safety, and welfare of Texans is not negotiable. 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."

Though Sparks’ ruling Wednesday is a small victory for SB4’s opponents, they must now wait and see what U.S. District Judge Orlando Garcia decides following a seven-hour hearing in Bexar County on June 26.

The Texas Tribune thanks its sponsors. Become one.

Opponents argued then that the law violates several provisions of the U.S. Constitution, including guarantees of equal protection and freedom of speech, and that given the bill’s broad language, it opens the door to racial profiling.

But the state, with the aid of attorneys from the U.S. Department of Justice, said Texas should be able to craft its own laws because of a 2012 U.S. Supreme Court ruling that upheld several key provisions of Arizona’s state-based immigration law.

“There is an ongoing debate in the country about federal immigration law,” First Assistant Attorney General Darren McCarty told Garcia in June. “That is a healthy and appropriate debate, and it should be decided in [state] legislatures and Congress. Where it is not appropriate to decide it — respectfully, your honor — is in litigation.”

But Efren Olivares, the director of racial and economic justice at the Texas Civil Rights Project, which represents some of the plaintiffs in the San Antonio case, said he was confident his side would prevail in San Antonio after Sparks saw fit to toss the state's initial challenge.

“Texas’ misguided lawsuit was a direct attack on democracy and local autonomy. The Texas Civil Rights Project continues its fight against SB4 and will not allow state officials to move their anti-immigrant agenda forward unchallenged,” Olivares said.

Read related Tribune coverage:

  • For the second time this week, the Texas attorney general's office sparred in federal court with opponents of the state's new immigration-enforcement law, Senate Bill 4. Both sides got an earful from federal Judge Sam Sparks. [Full story]

  • The Justice Department filed a statement of interest in the federal court case over Texas' Senate Bill 4, arguing that the state is within its rights to adopt the anti-"sanctuary cities" law. [Full story]

Never miss a moment in Texas politics with our daily newsletter.