Editor's note: This story was updated on Wednesday, February 8, 2017, to reflect the Senate's final vote on Senate Bill 4.

The Republican-controlled Texas Senate gave its final stamp of approval on Wednesday to a bill that would gut funding from local and state entities that don’t enforce immigration laws.

Senate Bill 4, filed by state Sen. Charles Perry, would punish local and state government entities and college campuses that refuse to cooperate with federal immigration officials or enforce immigration laws. Wednesday's vote was 20-10 along party lines, with state Sen. José Rodríguez, D-El Paso, absent. Rodriguez was present a day earlier, when the Senate tentatively approved it on a 20-11 vote.

The bill would also punish local governments if their law enforcement agencies fail to honor requests, known as detainers, from federal Immigration and Customs Enforcement officers to hand over immigrants in custody for possible deportation. Entities in violation would be stripped of state grant funding and also be subject to civil fines. Department heads could also be subject to criminal prosecution if they violate the provisions of the bill. The bill doesn’t apply to victims of or witnesses to crimes, public schools or hospital districts.

The legislation was listed last month as one of Gov. Greg Abbott’s emergency items, which allows lawmakers to vote on the issue before the traditional 60-day waiting period to hear bills on the floor of either chamber. Lt. Gov. Dan Patrick also deemed the bill a legislative priority.

The issue garnered national attention after Abbott made good on his promise this month to cut state funding for Travis County after that county's sheriff, Sally Hernandez, enacted a policy that greatly rolls back her department’s cooperation with ICE.

Wednesday’s vote followed an hours long debate on Tuesday where most of the amendments offered by Democrats were defeated. Like he did during a 16-hour committee hearing on the bill last week, Perry held his ground during the floor debate Tuesday, pushing back against accusations that his bill was a “deportation” bill after Democrats insisted the policy would cast a wide net and snare people in the country illegally but who are otherwise law abiding.

Perry said it was about the rule of law and making sure every law enforcement agency follows the same procedures. He added that even if a person is in the country illegally, he or she would not have a reason to fear his legislation if they didn’t commit crimes.

“This bill ensures that there is predictability that our laws are applied without prejudice” no matter who is in custody, he said. He also added that if a local government loses money because it adopted a "sanctuary" policy, the blame is on them.

Perry amended his bill Tuesday to add tough civil and criminal penalties for entities that don’t comply with the bill’s provisions. One amendment would make a department head whose agency violates the provisions of SB 4 subject to criminal prosecution in the form of a class A misdemeanor. Another added a provision that would subject the local agency to civil penalties, including a fine at least $1,000 for the first offense and $25,000 for each subsequent violation.

The severity of the proposals prompted state Sen. Sylvia Garcia, D-Houston to ask Perry how far he was willing to go.

“What’s the next [amendment] going to do? Take their first born?” she asked.

The upper chamber also predictably shot down by party line votes several amendments Democrats offered to make the bill more palatable to their constituents, including a measure by state Sen. Judith Zaffirini, D-Laredo, that would have excluded college campuses. An amendment by state Sen. José Menéndez, D-San Antonio, which sought to require peace officers to learn immigration law was also voted down, as was another by state Sen. Eddie Lucio, Jr. that would have prohibited the arrest of a person only because he or she was in the country illegally.

Garcia also asked Perry to remove a section of the bill that would punish a local entity for “endorsing” a policy that prohibits or discourages enforcing immigration law. Garcia said that section could be a violation of an elected official’s right to free speech and could be interpreted broadly.

Before the chamber began voting on the amendments, senators debated certain aspects of the bill for more than three hours. Republicans used the time to reiterate that the bill, as filed, would stand up to court challenges that might be brought over questions of constitutionality.

That debate was preceded by a memo attorney general Ken Paxton sent Perry, Lt. Gov. Dan Patrick and State Affairs Committee Chair Joan Huffman, R-Houston, in which Paxton said concerns over the bill’s legal standing were overblown.

“Our review of the law concludes CSSB 4 is constitutional, there are viable methods for covered entities to avoid liability regarding invalid detainers, and the remainder of the legal concerns are unfounded,” he said in the letter. “CSSB 4 would make great strides to keep communities secure by requiring state and local law enforcement to cooperate with federal agencies as they take care to faithfully execute the immigration laws of the United States.”

During the debate, Perry also said that the measure would be the first-ever legislation to codify protections for victims of or witnesses to crimes that agree to cooperate with law enforcement. That came after Democratic lawmakers said that even though the protections are in place, the immigrant communities would still operate under a blanket of fear if they reached out to law enforcement for any reason, including reporting a crime.

Perry said that the misinformation being pedaled about the bill might actually make it more difficult for police to get witnesses or victims to cooperate. But he said that left the door open for a “golden opportunity” for law enforcement to explain to the immigrant community what the bill actually does.

State Sen. John Whitmire, D-Houston, said that although lawmakers might be familiar with the nuances of the bill, the general public isn't and law enforcement officers from across the state have said repeatedly that hinders their efforts to investigate crimes and keep the streets safe.

“It may be a shame that people are afraid. But it doesn’t change the fact that people are afraid,” Whitmire said. “I am listening to the experts. It may be a shame they feel that way, but it’s absolutely true.”

After Tuesday's preliminary vote, Abbott praised SB 4 in a statement.

"Today's action in the Senate helps ensure that Sheriffs and officials across Texas comply with federal immigration laws and honor Immigration and Custom Enforcement detainer requests that keep dangerous criminals off of our streets," the statement read in part. "I want to thank Senator Perry for his leadership on this issue and look forward to final passage in the Senate tomorrow.”

The bill now heads to the Texas House, though whether the lower chamber accepts the bill as it's currently presented isn't clear. State Rep. Charlie Geren, R-Fort Worth, filed a companion bill to Perry’s original proposal, but the Texas House hasn't yet named committees and isn't moving as fast on this — or any other legislation — as the Senate is.

Read related Tribune coverage: