After months of grueling public testimony, House and Senate warfare and protests across the state, Gov. Greg Abbott signed a law banning "sanctuary cities" in Texas on Sunday night and he did it live on Facebook with no advance notice.

Here are five things you should know about Senate Bill 4 and how it will affect Texas' undocumented immigrants and local authorities.

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

Senate Bill 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.

2. 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.

3. 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.

4. When does the law take effect? 

The law is slated to take effect Sept. 1. Although Democrats were unable to kill SB 4, lawyers are already preparing to challenge it in court

 5. What about legal challenges to the law?

The Mexican American Legal Defense and Educational Fund, which represented some of the plaintiffs who successfully sued the state over its 2011 redistricting maps, has vowed to file a lawsuit in federal court.

Marisa Bono, a staff attorney at the organization, said her group hopes to shoot the regulations down before they are implemented in September. They’re taking aim at questions about what power states have to craft their own immigration enforcement laws and whether detainer requests from federal authorities are mandatory or voluntary.

Read related coverage:

Get The Brief

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