Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

May 4, 2017, 1:25 AM UTC / Updated May 4, 2017, 1:29 AM UTC

Texas state lawmakers gave final approval Wednesday evening to a ban on so-called sanctuary cities, threatening to throw local law enforcement chiefs in jail if they refuse to cooperate with federal immigration authorities.

The measure would make Texas the first state to ban sanctuary cities under the Trump administration when it goes into effect on Sept. 1.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

Republican Gov. Greg Abbott quickly tweeted: "I'm getting my signing pen warmed up."

The Texas sanctuary city ban wins final legislative approval. I'm getting my signing pen warmed up. #txlege #tcot https://t.co/OHmspC5Zhz — Greg Abbott (@GregAbbott_TX) May 4, 2017

The measure would also allow law enforcement officers to ask about the immigration status of anyone they detain for any reason, and it would require local police chiefs and sheriffs to obey federal demands to hold suspects for possible deportation.

BREAKING: My legislation to ban "Sanctuary Cities" in Texas has passed the legislature and is heading to @GregAbbott_TX's desk. #txlege #sb4 pic.twitter.com/n6kqBA1GYT — Sen. Charles Perry (@electcharles) May 3, 2017

"I have been working to end sanctuary cities in Texas since my days as a state senator," said Lt. Gov. Dan Patrick, a longtime proponent of the measure. "There is no excuse for endangering our communities by allowing criminal aliens who have committed a crime to go free."

Related: 'Sanctuary Cities' Vow to Resist Trump Order Despite Funding Threat

Democrats have fiercely opposed similar measures since the drive to ban sanctuary cities first emerged more than six years ago. Some sheriffs and police chiefs also have said the measure would actually make their jobs harder if immigrant communities — including crime victims and witnesses — become afraid of the police.

Protesters against the Senate Bill 4 Sanctuary Cities ban rally outside the Texas Department of Insurance building, where Republican Gov. Greg Abbott has an office in Austin, Texas, Monday, May 1, 2017. Jay Janner / Austin American-Statesman via AP

Democratic state Rep. Victoria Neave, who represents parts of Dallas, Mesquite and Garland, even launched a four-day hunger strike last month to draw attention to what she called "a dangerous game of political Russian roulette — with the lives of Texans at stake."

"This is personal," Neave told NBC News. "It's a form of sacrifice and protest, and this issue tugs at my heart."