As the Texas legislative session nears its official end, the state’s lieutenant governor is so set on passing a “bathroom bill” that he is threatening to hold the budget hostage and force a special session if he doesn’t get his way.

Sunday night, Lt. Gov. Dan Patrick’s tactic seemed to be working.

The House passed a measure that would prohibit transgender students in public and charter schools from using a bathroom that matches their gender identity.

Though the legislation is much narrower, it drew comparisons to the contentious North Carolina bill that spurred boycotts and protests, marring the state’s image and ultimately forcing at least the appearance of a retreat.

And that’s not all Texas lawmakers did Sunday night. The Senate voted to advance another bill decried by LGBT advocates as discriminatory, a measure that would allow publicly funded foster care providers and adoption agencies to refuse to place children with non-Christian, unmarried or gay parents because of religious objections.

It was a frenzied night for Texas Democrats and civil rights groups, who fiercely protested both measures across social media into the early hours of the morning.

Equality Texas shared a tweet from one critic who summed up the day in one post: “Let’s just call today discrimination Sunday.”

In an act of protest, a small group of Democratic women legislators went to the men’s restroom just off the House floor before the debate.

House Republicans advanced the hotly debated “bathroom bill” as an amendment tacked on to a broader, otherwise unrelated public school bill regarding emergency operations plans.

The proposal would require a transgender student who “does not wish” to use a facility based on “biological sex” to use single-occupancy restrooms, locker rooms and changing facilities at their schools.

It would override policies at some of the state’s school districts that already allow transgender students to use the bathroom that matches their gender identity.

During Sunday night’s emotional debate, Republican lawmakers said the measure was not intended to discriminate against transgender students but rather to protect the privacy and safety of all students.

That’s the same argument that was used by North Carolina and other backers of bathroom and locker room restrictions and rejected by President Obama’s administration, which took aggressive steps to force recalcitrant states into letting transgender students use the facilities of their choice.

The heat was taken off states with the election of President Trump, however, who revoked federal guidance issued by the Obama administration.

Democrats called the bill “shameful” and compared it to Jim Crow-era laws that established separate but equal facilities.

“White. Colored. I was living through that era … bathrooms divided us then, and it divides us now,” said Democratic state Rep. Senfronia Thompson of Houston, a black woman who has served in the House since 1972. “America has long recognized that separate but equal is not equal at all.”

The amendment passed 91-50 but still needs final approval by the House, expected as soon as Monday. The amended bill would then be sent to the Senate, where it is expected to sail through easily before being sent to the governor. The last day of the legislative session is May 29.

A broader measure that passed easily through the Texas Senate months ago would have barred transgender people from using public restrooms in all government buildings, public schools and colleges and universities. But that proposal went nowhere in the House.

A hefty push from Lt. Gov. Patrick (R) made the difference Sunday. While most lieutenant governors around the country have little formal power, Texas’ second-in-command is head of the senate and of the State Budget Board, exercising considerable sway over spending issues and crucial questions of legislative timing, such as when and if bills come to the Senate floor.

While the lieutenant governor does not have the authority to call a special session, he can force the governor into calling one by delaying enactment of the state budget past the end of the legislature’s regular session on May 29, which was exactly what he was threatening to do.

“Everyone in the Texas Capitol was reading from Dan Patrick’s script on the second-to-last weekend of the Legislature’s regular session,” Ross Ramsay of the Texas Tribune wrote Sunday night. ” … He has set himself up as a hero for the GOP’s most conservative voters — the people who put him in office.”

Republican Gov. Greg Abbott has said he wants to sign a bathroom bill into law. House Speaker Joe Straus, a Republican from San Antonio, had firmly opposed the broader bill. that applied to all government buildings, saying it could damage Texas’ economy by provoking boycotts similar to those that hit North Carolina.

But after the amended bill limited to schools passed the house Sunday, Straus spoke approvingly of it, saying the measure will “allow schools to continue to handle sensitive issues as they have been handling them.”

Nothing in federal law explicitly protects the rights of transgender people to use facilities according to their gender identity. The Supreme Court was set to consider whether the law offered some implicit guarantee but after government’s position on transgender student rights changed, the court decided to pass on the subject.

It had previously agreed to review the case of Gavin Grimm, a transgender teenager from Virginia fighting for the right to use the boys’ bathroom at his high school. The high court remanded the case to the U.S. Court of Appeals for the 4th Circuit, leaving parents of transgender students without the answers they had sought.

In late March, North Carolina lawmakers repealed that state’s “bathroom law” in the face of economic pressure in the form of boycotts, including one by the NCAA.

It enacted a new bill that banned local governments from passing measures to protect LGBT people, The Post reported. Gay rights groups attacked the new law as equally discriminatory.

In Texas, Rep. Chris Paddie, a Republican from Marshall, sponsored the amendment, calling it an effort to provide “definitive guidance” to school districts in regard to restrooms, locker rooms and changing facility safety for “all kids.”

He said there was “absolutely no intent” to discriminate, saying the measure makes sure there are “reasonable accommodations for all children” who might want to use a single-stall restroom.

“That could be because you’re transgender, that could be because you’re shy,” Paddie said. “Maybe that child, boy or girl, is a victim of bullying.”

Rep. Joe Moody, a Democrat from El Paso, was among those who took issue.

” … The bathroom bill is an attack on transgender people,” Moody said. “Some people don’t want to admit that because they are ashamed, and this is shameful.”

The Texas Association of School Boards voiced its approval of the measure, calling it a “common-sense solution.”

“The language captures in law a solution many districts already use locally, seeking a balance between ensuring privacy and security for all students and respecting the dignity of all students,” the Texas Association of School Boards said in a statement.

The Human Rights Campaign urged the state to halt the measure, saying in a statement, “policies such as this one, which make classifications on the basis of ‘biological sex,’ are designed to alienate transgender students from their peers.”

“This shameful amendment is yet another example of Texas lawmakers’ anti-LGBTQ agenda,” said JoDee Winterhof, senior vice president for policy and political affairs for the group. “Transgender youth deserve the same dignity and respect as their peers, and this craven attempt to use children as a pawn for cheap political points is disturbing and unconscionable.”

Rep. Jason Villalba, a Republican from Dallas, initially tweeted he would be voting against any amendment to the senate bill, saying “discrimination is not a Texas value,” and drawing praise from opponents of such a measure. But then he unexpectedly spoke in favor of the amendment during the hearing. He later defended his support on Twitter, calling the proposal an “anti-bullying amendment, not a bathroom bill.”

But Rep. Eddie Rodriguez, a Democrat, said in an interview with The Post “it’s not innocuous at all.” He argued the measure would keep transgender schoolchildren out of the bathroom they feel most comfortable using and would single them out as different from their peers “over something they can’t control.”

“The bottom line is this doesn’t address the equal protection problem,” he said. “Gender neutral facilities period needs to be the solution.”

As the House debated the transgender bathroom amendment, the Senate voted on the adoption agency “religious refusal” bill, a measure opponents say uses taxpayer money to discriminate against LGBT people seeking to be foster or adoptive parents.

Proponents have said that the legislation would provide faith-based groups protection from lawsuits and would encourage more of them to participate as child welfare providers. Among the state’s child welfare providers, 25 percent identify as faith-based.

The Senate gave preliminary approval of the bill Sunday night. A final vote, possibly Monday, would send it to Republican Gov. Greg Abbott for his consideration. Texas would become the latest state to protect faith-based adoption agencies that reject families on religious grounds. South Dakota, Michigan, North Dakota and Virginia have passed similar legislation, while Alabama enacted its own law earlier this month.

More from Morning Mix