Editor's note: This story has been updated with current information on the legal battles surrounding Senate Bill 4.

After months of grueling public testimony, House and Senate warfare and protests across the state, Gov. Greg Abbott signed a bill banning “sanctuary cities” in Texas in May. But the first cannon in the legal battle was fired shortly after, setting the stage for a lengthy and divisive ride to Sept. 1 — when the new law goes into effect — and potentially beyond. Here’s everything you need to know:

What does Senate Bill 4 do, and what are the consequences for not following it?

SB 4 aims to outlaw "sanctuary cities" by requiring local police to cooperate with federal immigration authorities and allowing police to inquire about the immigration status of people they lawfully detain. Under SB 4, local authorities are forbidden from adopting policies that prevent a peace officer from asking about a person's immigration status.

The Texas Tribune thanks its sponsors. Become one.

Sheriffs, constables, police chiefs and other local leaders can be slapped with a Class A misdemeanor — and possibly jail time — if they don’t cooperate with federal immigration authorities by honoring requests to hold inmates who are subject to deportation. They also could face civil penalties: $1,000 for a first offense and up to $25,500 for subsequent infractions. These penalties also apply to public colleges.

What does this mean for undocumented immigrants?

Police officers will now be able to question a person’s immigration status upon detainment. House Republicans expanded the scope of questioning in a controversial amendment that incensed Democrats and immigrant rights groups, who called it a "show-me-your-papers" law. 

Opponents of the law worry it will turn routine exchanges like traffic stops into excuses for police to flag immigrants for deportation. “When people go from a broken taillight to a broken family to broken trust in the system, that is real,” Houston Democratic Sen. Sylvia Garcia said during the Senate debate in February. Some lawmakers also worry it could discourage undocumented immigrants who are victims of crimes from contacting the police. 

Sen. Charles Perry, the Lubbock Republican who authored the anti-sanctuary legislation, pointed out that police are not required to to ask about the immigration status of anyone lawfully in their custody — but the law still makes it legal for them to do so.

The law also applies to college campuses, meaning students may think twice before attending or hosting any parties. Democrats worry minor offenses like possession of alcohol could trigger a path to deportation. Administrators at public colleges have to comply with the law or they, too, face penalties.

The Texas Tribune thanks its sponsors. Become one.

How does the Texas law compare to Arizona's so-called "show me your papers" law?

Arizona's law, passed in 2010, made national news but has since been blunted by legal challenges. Unlike the Texas law, which allows police to ask about immigration status, Arizona's Senate Bill 1070 required police to do so. But Arizona's attorney general later told police to ignore that provision as part of a settlement agreement. Arizona's law doesn't require local authorities to honor federal detainer requests, as the new Texas law does.

Who supports the new law?

Three of the state’s top four officials — Abbott, Lt. Gov. Dan Patrick and Attorney General Ken Paxton — have been publicly supportive of SB 4, and Republicans in general back the measure. Paxton sought to get ahead of the SB 4 legal fight right after Abbott signed it, requesting a federal court declare the new law constitutional.

The Trump administration also joined the fight in June, filing a statement of interest that argued SB 4 was constitutional and not pre-empted by federal immigration law. Supporters say SB 4 will crack down on illegal immigration and argue the language in the new law isn’t as consequential as some make it out to be.

Who’s lined up against SB 4 so far?

Maverick County and the border city of El Cenizo kicked off the lawsuit against SB 4 the day after Abbott signed the measure into law. Since then, the cities of Houston, Dallas, San Antonio, Austin and El Paso, along with El Paso County have joined. The Mexican government has also said it plans to file an affidavit to express concerns over SB 4.

SB 4 violates the Texas and U.S. constitutions, plaintiffs say, and Democrats and immigrants’ rights groups argue the new law is essentially “show-me-your-papers” legislation. They also believe the law, once in effect, will lead to racial profiling.

The Texas Tribune thanks its sponsors. Become one.

The city of Fort Worth remains the last large city in the state that hasn’t registered support or opposition to SB 4.

Where does the legal battle against SB 4 stand?

U.S. District Judge Orlando Garcia in San Antonio heard a federal lawsuit against SB 4 on June 26, with opponents of the measure billing it as the toughest immigration law in the nation and supporters saying litigation wasn’t the appropriate place for debate.

Later that week, U.S. District Judge Sam Sparks considered Paxton’s lawsuit in a federal courthouse in Austin, where he hammered at the politics surrounding SB 4 and hinted he wouldn’t have the time to take the case over from Garcia.

Neither Garcia nor Sparks made a decision during their hearings, and they didn’t indicate when they planned to announce a ruling, either. If Sparks rules he doesn’t have jurisdiction to declare SB 4 constitutional since the law hasn’t gone into effect yet — a question he raised himself during the hearing — then the SB 4 fight would shift back to San Antonio.

Read related coverage:

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