Texas took its legal battle over immigration to a new level Sunday, suing one of its own counties in an effort to “uphold the constitutionality” of a controversial law set to force law enforcement agencies across the state to detain suspected undocumented immigrants.

On Sunday, Republican Gov. Greg Abbott signed into law Senate Bill 4 (SB 4), which makes it a crime for law enforcement officers to ignore Immigration and Customs Enforcement requests to hold people in jail until the feds can come pick them up. The law, which is the first of its kind in the county, targets so-called “sanctuary jurisdictions” like Travis County (where Austin is located) which refuse to honor such “detainer requests.”

By filing the lawsuit, called a “complaint for declaratory action,” Texas is seeking to have a federal court declare that law constitutional, before Austin, Travis County or groups like the Mexican American Legal Defense and Education Fund — all of which are named in the lawsuit — can sue the state over it.

“This is a frivolous legal action, filed precipitously and without basis in the law,” Thomas A. Saenz, MALDEF’s president and general counsel, said in a statement. He also said the group intends to sue over the law. “The state bespeaks its own apparent high anxiety about the legality of Abbott’s Folly, SB 4, by seeking a preemptive strike through this lawsuit.”

The lawsuit also names officials such as Travis County Sheriff Sally Hernandez — who declared in February that her officers would not honor ICE detainer requests and who the lawsuit dubs “publicly hostile to cooperation with federal immigration enforcement” — as defendants in their official capacity. Several of these officials have denounced the law as unconstitutional, according to Texas’ lawsuit.

Under Texas’ new law, if a law enforcement officer who oversees a jail, such as a sheriff or a chief of police, ignores an ICE detainer request, he or she may be charged with a Class A misdemeanor, which could result in fines or even jail time. The law also also allows police to inquire about detained people’s immigration status, which critics argue could allow cops to ask people about their status even during routine detentions like traffic stops.