AUSTIN, Texas (AP) -- Texas pushed to the forefront of national debate over immigration Sunday night when Republican Gov. Greg Abbott signed a so-called "sanctuary cities" ban that lets police ask during routine stops whether someone is in the U.S. legally and threatens sheriffs with jail if they don't cooperate with federal immigration agents.

The new Texas law was blasted by opponents as the nation's toughest on immigrants since Arizona's crackdown in 2010, disparagingly known as the "papers, please" provision. They are now vowing a court challenge in Texas similar to what unfolded in Arizona.

Every major police chief in Texas, which includes some of the largest cities in the U.S., opposed the measure that allows police to inquire about the immigration status of anyone they detain, a situation that can range from arrest for a crime to being stopped for a traffic violation.

It also requires police chiefs and sheriffs — under the threat of jail and removal of office — to comply with federal requests to hold criminal suspects for possible deportation. Republicans have a strong majority in the Legislature and shoved aside Democratic objections, even as President Donald Trump's efforts to withhold federal funding for sanctuary cities have hit roadblocks in federal courts.

"Let's face it, the reason why so many people come to America is because we are a nation of laws and Texas is doing its part to keep it that way," Abbott said.

The timing of the signing caught Democratic lawmakers flatfooted. Abbott signed the bill on a Facebook livestream with no advanced public warning. Protests over the Texas bill have been intense for months and about 20 people were charged with criminal trespassing last week after staging a daylong sit-in at a state building where some of Abbott's staff works.

Democratic state Rep. Cesar Blanco said it looked like Abbott "wanted to get ahead" of any protests surrounding the bill signing. Abbott spokesman John Wittman said they chose to sign the bill on a Facebook livestream because that's "where most people are getting their news nowadays."

Story continues

The bill cleared a final hurdle this week in the Republican-controlled Legislature over objections from Democrats and immigrant rights supporters who've packed the Texas Capitol. They call it a "show-me-your-papers" measure that will be used to discriminate against Latinos

Texas is nation's second most populous state, and opponents say Hispanics will now be subjected to racial profiling and predicted the law will have a chilling effect on immigrant families.

The bill won't take effect until Sept. 1. Terri Burke, executive director of the ACLU of Texas, said "we will fight this assault in the courts" and the ballot box. Abbott said key provisions of the bill had already been tested at the U.S. Supreme Court, which struck down several components of Arizona's law but allowed the provision permitting police to ask about immigration status.

The term "sanctuary cities" has no legal definition, but Republicans want local police to help federal immigration agents crack down on criminal suspects in the U.S. illegally. Some Democrats said the timing of the signing particularly stung after three recent federal court rulings that found intentional discrimination in Republican-passed voting laws.

"They did not connect the history of our culture or how closely that it is tied to Mexico," Democratic state. Rep. Eddie Rodriguez said. "It's just extremely personal. There is a lot of disconnect. They don't really see this as affecting people."

The Texas and Arizona bills are not identical. Whereas the Arizona law required police to try to determine the immigration status of people during routine stops, the Texas bill doesn't instruct officers to ask. But it does allow Texas police to inquire whether a person is in the country legally, even if they're not under arrest.

Texas doesn't currently have any cities which have formally declared themselves sanctuaries for immigrants.

But Sally Hernandez, the sheriff of Travis County, which includes liberal Austin, enraged conservatives by refusing to honor federal detainer requests if the suspects weren't arrested for immigration offenses or serious crimes such as murder. Hernandez softened her policy after Abbott cut funding to the county, saying decisions would be made on a case-by-case basis. She has said she will conform to the state's ban if it becomes law.

___

This version of the story corrects the first name of Terri Burke, the executive director of the ACLU of Texas.

___

Associated Press Writer Will Weissert contributed to this report.

___

Follow Paul J. Weber on Twitter: www.twitter.com/pauljweber