Editor's note: This story has been updated throughout.

After more than 16 hours of debate, the Texas House of Representatives early Thursday morning tentatively gave a nod to the latest version of a Senate bill that would ban “sanctuary” jurisdictions in Texas.

The 93-54 vote fell along party lines and came after one of the slowest moving but most emotional legislative days at the state Capitol.

The vote came at 3 a.m. after state Rep. Dennis Bonnen, R-Angleton, successfully made what some Democratic members called an unprecedented motion to group all of the remaining amendments — more than 100 — and record them as failed. He said he made that suggestion so members wouldn't be forced to pull their amendments. The motion passed 114 to 29, with about a third of Democrats approving the measure.

Members voted on the bill after adding back a controversial provision that extends the scope of the bill and allows local peace officers to question the immigration status of people they legally detain. The original House version of the bill only allowed officers to inquire about status during a lawful arrest.

That detainment language was included in what the Senate passed out of its chamber in February but was later removed by state Rep. Charlie Geren, R-Fort Worth, the bill’s House sponsor.

The amendment to add that provision back into the bill was offered by Tyler Republican Rep. Matt Schaefer, who was in the middle of a back-and-forth, deal-making struggle that stopped debate for more than hour. Both parties’ members caucused as they tried to hammer out a deal whereby Schaefer would pull his amendment and Democrats would limit the number of proposals they would offer.

But no compromise was reached, despite several high-profile Republicans, including Geren and House State Affairs Committee Chairman Byron Cook, R-Corsicana, telling members they would vote against the Schaefer proposal.

The intent of bill is “getting dangerous criminals off the street. That's the mission. Shouldn't be any more than that," Cook said.

The bill keeps a provision that makes sheriffs, constables and police chiefs subject to a Class A misdemeanor for failing to cooperate with federal authorities and honor requests from immigration agents to hold noncitizen inmates subject to removal. It also keeps civil penalties for entities in violation of the provision that begin at $1,000 for a first offense and swell to as high as $25,500 for each subsequent infraction."

Democrats also offered myriad amendments that sought to shield people at certain places from being subject to the provisions of the bill. Those include domestic violence shelters, homeless shelters, pre-kindergarten schools, and public school events such as football games. All failed along party-line votes.

House Democrats scored one victory with an amendment by Rep. Victoria Neave, D-Dallas, that allows local entities to prohibit their employees and peace officers from assisting federal immigration officers at places of worship. (The bill already excludes commissioned peace officers who are employed by religious organizations.)

The emotional debate that members witnessed early on in the afternoon continued as the daylight faded. At one point, Rep. Mary González, D-Clint, told members that she was once a victim of sexual assault and said immigrants would fear reaching out to police should something similar happen to them.

She pleaded with members to keep the language about status inquiries limited to only people under arrest.

“If you ever had any friendship with me, this is the vote that measures that friendship," González pleaded. But amendments by her and her Democratic colleagues were shot down repeatedly before the final vote on the bill.

Throughout the floor debate, House Democrats had done everything from warning Republicans against heckling them to shedding tears during floor speeches.

Before debate on actual policy started, Democrats tried their best to tug at Republican heartstrings in hopes of diluting what they labeled an “intentionally” racist proposal.

State Rep. Ana Hernandez, D-Houston, recounted through tears how she was undocumented for years after her visa expired when she was growing up.

She said the bill exemplifies the fear her parents experienced "each day their little girls went to school. Worrying about an immigration raid.” Hernandez gave a similar speech in 2011, the last time the Texas House took up a “sanctuary” measure.

She was followed by state Rep. Victoria Neave, D-Dallas, who’s been fasting in protest of the bill since she last attended church on Sunday. She said she’s received hate mail telling her to “die” and “starve.”

Addressing “sanctuary” jurisdictions was declared an emergency item by Gov. Greg Abbott in the early days of the 85th legislative session. SB 4 passed the Senate in February.

House members had expected a rough debate. Before the bill reached the House floor, one member predicted “trench warfare,” while another said that “battle lines have been drawn.” A third House member simply predicted “a total shitshow.”

Houston-area Reps. Gene Wu and Harold Dutton, both Democrats, added their own opinions Wednesday. A choked-up Wu said the bill was personal to him as an immigrant, and he recounted the fear the proposal has stirred in his district. Dutton calmly recited the history of what he deemed racist pieces of legislation and their effects on women, Chinese immigrants, former slaves and other minority groups.

Through it all, Geren stood his ground and said the bill wasn’t about targeting minorities or about racial profiling. Geren said it's about focusing efforts on deporting undocumented criminals.

“Most of the [immigrant community] is not a lawless community,” he said. “And that’s why we are going [only] after the ones that are criminals.”

State Rep. Jason Villalba, R-Dallas, had Geren’s back. He said his immigrant relatives were called “spics” and “wetbacks.” But he said the bill was commonsense policy that was about the rule of law.

Either way, Democrats said they intend to keep fighting. During his floor speech, the usually mild-mannered Rep. Eddie Lucio III, D-Brownsville, warned Republicans: “Do not mess with us today.”

The House version has a provision that forces college campus administrators to comply with the bill, which Democrats have argued could get college students deported for relatively minor offenses such as being a minor in possession of alcohol.

Proponents of the legislation say it is about the rule of law and ensuring law enforcement agencies follow the same policies.

“This bill ensures that there is predictability that our laws are applied without prejudice” no matter who is in custody, state Sen. Charles Perry, R-Lubbock, said when the Senate voted on SB 4 in February.

Opponents of the measure say it would make communities less safe as many undocumented immigrants would be reluctant to reach out to police for fear of being deported. They also fear it would open the door to racial profiling and argue it’s not needed because local jails already cooperate with immigration officers.

“We know the Republicans have the numbers in the building,” said state Rep. Chris Turner, D-Grand Prairie, the chairman of the House Democratic Caucus. “You’re going to see Democrats fighting very hard through a variety of tactics, including amendments detailing the deficiencies of the bill, the pointlessness of the bill.”

Tensions in the House began percolating this week when Democrats successfully blocked a procedural maneuver known as a calendar rule. The rule would have set a 1 p.m. Tuesday deadline for proposed amendments to SB 4. Democrats said that would have given Republicans too much time to study the amendments and find ways to cut off debate.

Wednesday’s debate comes just a day after Austin Mayor Steve Adler revealed that, according to what U.S. Attorney General Jeff Sessions told him at a meeting about what the federal government considers a "sanctuary" jurisdiction, neither Austin nor Travis County is considered one.

It also comes after a federal judge on Tuesday ruled that President Donald Trump exceeded his authority when he signed an executive order withholding federal money from "sanctuary" cities in the country. The judge ruled that only funds related to immigration enforcement can be withheld, according to the Associated Press.

Watch the Texas House debate the bill at the top of this page.

Read related Tribune coverage:

The latest version of the Texas Legislature’s bill to outlaw "sanctuary cities" in Texas is a scaled-down version of what the state Senate passed out in February.

Former immigration and border officials say the Trump administration is floating ideas related to immigration that range from nullifying treaties to expanding employment screenings.

Disclosure: Steve Adler, a former Texas Tribune board chairman, has been a financial supporter of the Tribune. A complete list of Tribune donors and sponsors can be viewed here.