WASHINGTON—The full U.S. House of Representatives swats down a transgender measure, just hours after 43 Republicans voted for a Democratic amendment that would have forced transgender rules on all 50 states, and disqualify faith-based groups including the Salvation Army from doing business with the federal government.

Last night, 43 Republicans in the House voted for an amendment offered by Democrat Sean Maloney of New York, inserting in H.R. 5055, the Energy and Water Appropriations Act for 2017, a provision making the White House’s transgender policy part of federal law. The amendment passed 223-195 only because of these Republican defections.

Public backlash in the hours after that vote has been nationwide in scope and passionate in intensity. This morning most of those Republicans whipsawed to fall in line with their party base in opposing their own measure, joined by many moderate Democrats surprised as the fury the transgender amendment created. The amended appropriations crashed and burned on the House floor, failing by a vote of 113-305.

This saga began when President Barack Obama signed Executive Order 13672 on July 21, 2014. His order illegally changed federal law by forbidding any private organization from receiving a business contract with the federal government unless it agrees to adopt liberals’ homosexual and transgender agenda (that a person can require others to treat a man as a woman, or a woman as a man, if that person identifies with the opposite sex).

Executive Order 13672 also required all federal agencies to adopt these policies on sexual orientation and gender identity for all hiring and personnel matters.

This issue burst onto the national scene in recent months. For more than a year, the LGBT Left has pushed city ordinances nationwide making these policies the law in those cities.

Then on May 13, 2016, the Office of Civil Rights (OCR) at the U.S. Department of Education (DOEd) issued a letter informing local schools that unless they adopt a transgender policy, they can lose all federal funding, because the Obama administration regards those schools as violating Title IX of the Civil Rights Act of 1964.

As Breitbart News reported on the effect of OCR’s policy:

In other words, if a 17-year-old boy says that he now identifies as a girl, and wants to use his high school girls’ shower at the same time that a 15-year-old girl is showering in that same shower room, and the school does not allow the boy to share the shower with the girl, then the federal government can strip that high school of federal funding.

The Obama administration’s directive has stirred a great deal of controversy.

In the midst of it, North Carolina passed a bill requiring people to use public restrooms that match the sex listed on their birth certificate, reaffirming that the state would adhere to the definition of “sex” used by the entire world for more than 5,000 years, a bill against which the political Left organized opposition nationwide.

Obama’s U.S. Department of Justice filed a lawsuit against North Carolina, accusing it of violating not just the Civil Rights Act’s Title IX, but Title VII as well (saying that employers that decline to recognize someone’s gender identity—including calling male employees “she” and female employees “he” when those employees insist—are engaging in “sex discrimination”).

Even though North Carolina law provided a procedure where a person could change the sex on their birth certificate, and so HB2 did not make it impossible for people to use the bathroom of the sex they identified with. But the attacks have continued regardless, allies of Obama and Hillary Clinton have demonized the measure as a form of discrimination.

North Carolina responded with a lawsuit of its own. Then yesterday, eleven additional states likewise sued the federal government, raising numerous legal arguments and challenging the constitutionality of Obama’s actions.

Had H.R. 5055 become law, it would have guaranteed that the states would lose most of the issues in their lawsuit, leaving only a couple legal arguments remaining, arguments with only an uphill chance of success.

When Maloney’s amendment passed last night, Family Research Council President Tony Perkins condemned the move, saying, “Congress should not allow the government to punish faith-based contractors, like the Salvation Army, that work and hire in accordance with their First Amendment freedoms.”

In the same statement, Perkins praised a separate amendment offered by Rep. Bradley Byrne in the National Defense Authorization Act, which would safeguard religious liberty.

Phones were ringing off the hook on Capitol Hill, and the bill’s supporters beat a hasty retreat this morning.

“We are very pleased that this bill has been soundly defeated due to the Maloney Amendment,” Concerned Women for America CEO Penny Nance exclusively told Breitbart News after the stunning defeat of the amended bill.

“But to think that 43 Republicans would join President Obama to promote transgenderism and force the marginalization of our Christian beliefs is appalling,” Nance added. “So you can rest assured that the effects of this vote will continue to be felt as we move forward.”

Ken Klukowski is legal editor for Breitbart News. Follow him on Twitter @kenklukowski.