Texas pushed to the forefront of national debate over immigration Sunday night when Republican Governor Greg Abbott signed a so-called "sanctuary cities" ban that lets police ask during routine stops whether someone is in the US 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 US, 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."

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 US Supreme Court, which struck down several components of Arizona's law but allowed the provision permitting police to ask about immigration status.

Donald Trump's first 100 days: in cartoons Show all 33 1 /33 Donald Trump's first 100 days: in cartoons Donald Trump's first 100 days: in cartoons Donald Trump's first 100 days in office were marred by a string of scandals, many of which caught the eye of the Independent's cartoonists Donald Trump's first 100 days: in cartoons Trump's first 100 days have seen him aggressively ramp up tensions with his nuclear rivals in North Korea Donald Trump's first 100 days: in cartoons Mr Trump has warned of a "major, major conflict" with the pariah nation lead by Kim Jong Un Donald Trump's first 100 days: in cartoons Mr Trump dropped the "mother of all bombs" on alleged ISIS-linked militants in Afghanistan, amid an escalation of US military intervention around the globe Donald Trump's first 100 days: in cartoons Mr Trump has been accused of falling short of the standards set by his predecessors in the Oval Office, including Franklin D Roosevelt Donald Trump's first 100 days: in cartoons The tycoon's ascension to the White House came at a time when the balance of power is shifting away from Western nations like those in the G7 group Donald Trump's first 100 days: in cartoons Western politicians, including the British Conservative party, have been accused of falling in line behind Mr Trump's proposals Donald Trump's first 100 days: in cartoons Brexit is seen to have weakened Britain, reducing still further any political will to resist American leadership Donald Trump's first 100 days: in cartoons Mr Trump's leadership has been marked by sudden and unexpected shifts in global policy Donald Trump's first 100 days: in cartoons Trump's controversial missile strike on Syria, which killed several citizens, was seen by some analysts as an attempt to distract from his policy elsewhere Donald Trump's first 100 days: in cartoons The President has also spent a large majority of his weekends golfing, rather than attending to matters of state Donald Trump's first 100 days: in cartoons Though free of gaffes, a visit from Chinese president Xi Jinping spotlighted trade tensions between the two states Donald Trump's first 100 days: in cartoons One major and unexpected setback came when Mr Trump's Healthcare Bill was struck down by members of his own party Donald Trump's first 100 days: in cartoons Mr Trump has been a figure of fun in the media, with his approval at record lows Donald Trump's first 100 days: in cartoons A string of revelations about Mr Trump's financial indiscretions did not mar his surge to the White House Donald Trump's first 100 days: in cartoons Outgoing President Barack Obama was accused of wiretapping Trump Tower by his successor in America's highest office Donald Trump's first 100 days: in cartoons The alleged involvement of Russian intelligence operatives in securing Mr Trump the presidency prompted harsh criticism Donald Trump's first 100 days: in cartoons The explosive resignation of Security Adviser Michael Flynn, who lied about his links to the Russian ambassador, was just one scandal to hit the President Donald Trump's first 100 days: in cartoons Many scandals, such as the accusation Barack Obama was implicated in phone-hacking, first broke on Mr Trump's Twitter feed Donald Trump's first 100 days: in cartoons Donald Trump's election provoked mass protests in the UK, with millions signing a petition to ban him from the country Donald Trump's first 100 days: in cartoons Donald Trump cited a non-existent terror attack in Sweden during a campaign rally Donald Trump's first 100 days: in cartoons Donald Trump stands accused of stoking regional tensions in Eastern Asia Donald Trump's first 100 days: in cartoons North Korea has launched a number of failed nuclear tests since Mr Trump took power Donald Trump's first 100 days: in cartoons Theresa May formally rejected the petition calling for Mr Trump to be banned from the UK Donald Trump's first 100 days: in cartoons When Mr Trump's initial so-called Muslim ban was struck down by a federal justice, the President mocked the 69-year-old as a "ridiculous", "so-called judge" Donald Trump's first 100 days: in cartoons A week after his inauguration, Theresa May met with Mr Trump at the White House Donald Trump's first 100 days: in cartoons Donald Trump's first days in office were marked by a hasty attempt to follow through on many of his campaign promises, including the so-called Muslim ban Donald Trump's first 100 days: in cartoons Donald Trump's decision to ban citizens of many majority-Muslim countries from the US sparked mass protests Donald Trump's first 100 days: in cartoons Revelations about Donald Trump's sexual improprieties were not enough to keep him from being elected President Donald Trump's first 100 days: in cartoons British PM Theresa May was criticised by many in the press for cosying up to the new President Donald Trump's first 100 days: in cartoons One of Mr Trump's top aides, Kelly Anne Conway, was mocked for describing mistruths as "alternative facts" Donald Trump's first 100 days: in cartoons British PM Theresa May was quick to demonstrate that her political aims did not hugely differ from Mr Trump's Donald Trump's first 100 days: in cartoons Donald Trump's inauguration, on 20 January 2017, sparked protests both at home and abroad

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