The House floor is turning into an emotional, and at times ugly, battleground over LGBT rights, as Democrats accuse Republicans of promoting bigotry and discrimination over proposals GOP leaders say are intended to protect freedom of religion from government overreach.

The conflict erupted on Thursday when Republican leaders successfully whipped their members to vote down a Democratic amendment that sought to prevent taxpayer dollars from being used to pay contractors that discriminate against employees on the basis of sexual orientation or gender identity.

The proposal authored by Rep. Sean Maloney (D-N.Y.), an openly gay member of Congress, appeared on the cusp of being adopted as the vote came to a close, but at the last minute six Republican members switched their votes and the amendment was defeated on a 212-to-213 vote.

Outraged Democrats shouted “shame” and accused Republican leaders of abusing chamber rules by holding the vote open until they could twist enough arms to kill the amendment.

“They literally snatched discrimination out of the jaws of equality,” Maloney said. “We won this vote.”

Maloney told reporters that when he saw House Majority Leader Kevin McCarthy (R-Calif.) “personally twisting arms on the floor,” he asked him to let the vote conclude only to be told to “to get back on my own side” of the aisle.

Democratic leaders have accused seven Republicans of changing their votes on Maloney’s amendment under pressure from Republican leaders, including: Reps. Darrell Issa, Jeff Denham, Mimi Walters and David Valadao of California; Greg Walden of Oregon who is also the chair of the House GOP campaign arm; David Young of Iowa; and Bruce Poliquin of Maine.

Spokespersons for most those members did not immediately return requests for comment Thursday afternoon; in a statement, Poliquin said he was “outraged that political opponents or members of the press would claim or insinuate that I cast a vote due to pressure or party politics,” but did not directly refute the charge that he changed his vote.

Twenty-nine other Republicans voted in favor of the amendment. But they weren’t necessarily happy to see the issue raised in the context of an appropriations bill.

“Too many members are losing perspective on what it is we’re trying to do today, so that’s I guess what frustrates me,” said Rep. Charlie Dent (R-Pa.) who chairs the Appropriations subcommittee that wrote Thursday’s bill.

The moderate Republican backed Maloney’s amendment on Thursday — and before that, tried to strip out the religious liberty language from the bill that eventually landed on the floor.

Dent said he anticipated similar amendments to “many more appropriations bills” in the future.

Democrats have not yet specified where they plan to bring up anti-discrimination measures going forward, save to promise that more will be coming soon.

Democratic leaders took the opportunity to accuse House Speaker Paul Ryan (R-Wisc.) of being hypocritical in promising a more transparent process.

“Evidently Speaker Ryan’s promises of regular order mean nothing, when regular order means a majority of the House standing up to protect LGBT Americans from bigotry,” House Minority Leader Nancy Pelosi (D-Calif.) said.

Advocates for LGBT rights are also decrying GOP leaders for having “abused the voting procedures” and the members who changed their votes for “shamefully” allowing them “to write discrimination into federal law,” David Stacy of the Human Rights Campaign said.

A GOP leadership aide retorted that holding a two minute vote open for seven minutes “is not significantly out of the ordinary,” and that “no one was forced to change their vote.”

After the vote closed, House Minority Whip Steny Hoyer (D-Md.) took to the microphone to rail against Republicans in protest, as House Minority Leader Nancy Pelosi (D-Calif.) walked around the Democrats’ side of the floor waving a red vote card and urging her members to vote no on the underlying military construction and veterans programs spending bill so that Republicans “get the message.”

But GOP leaders made no apology for prioritizing veterans and troops “over a political messaging amendment that could have jeopardized the final passage of the appropriations bill,” said AshLee Strong, a spokeswoman for House Speaker Paul Ryan (R-Wisc.)

The spending bill ultimately was passed on a 295-to-129 vote, with 57 Democrats voting in favor of the legislation. Only four Republicans voted against the final bill, and none of those four had supported Maloney’s amendment.

The House fracas comes as a national debate is underway over LGBT rights. The battle has reached a fever pitch in North Carolina, where Gov. Pat McCrory (R) signed into law a measure to ban transgender individuals from using a bathroom that does not correspond with the gender on their birth certificates. Corporations boycotted the state after the measure was enacted, and the federal government and North Carolina have now slapped competing lawsuits against each other.

'My God, what's wrong with you?': Grayson's speech on 'bathroom law' (C-SPAN)

Tensions over the issue in the House surfaced in recent weeks when a provision was added to the annual defense policy bill by Rep. Steve Russell (R-Okla.) that would exempt religious organizations that contract with the federal government from certain parts of civil rights law and the Americans with Disabilities Act. Democrats and some moderate Republicans decried the proposal, but earlier this week GOP leaders blocked them from holding a vote to strip the language from the defense bill when it was on the floor.

The battle then moved to Thursday when the chamber considered one of the 12 annual appropriations bills, which historically have been allowed to have a more free-wheeling amendment process.

The vote on Thursday is just one chapter in a fight that promises to occupy Congress in the coming weeks as both Republicans and Democrats plan further legislative measures to force the House to take a stand on the divide over whether certain policies, such as those concerning hiring practices and public bathrooms, amount to LGBT discrimination or protections for freedom of religion.

When and where the fight will be waged remains murky.

Ryan declined to say on Thursday whether Republicans would bring up measures to curtail the Obama administration’s efforts on LGBT rights, which include his recent directive to schools to accommodate transgender students in the bathrooms of their choosing. Ryan told reporters only that that such matters “should be left up to the states.”

But Ryan “is engaged in understanding” how the House will try to push back on the transgender bathrooms issue, House Rules Committee Chairman Pete Sessions (R-Tex.) said.

“We’ve encouraged him, I’ve encouraged him, he’s been encouraged,” he added.

One option may be a new bill from Rep. Luke Messer (R-Ind.), which seeks to block President Obama’s executive order on transgender bathrooms by preventing the administration from withholding federal funding from schools that don’t comply with the order. Messer said Thursday he is looking for must-pass vehicles as potential avenues for the legislation, such as appropriations bills.

“I can assure you we’ll try to do something in appropriations on this issue for sure,” said Rep. Tom Cole (R-Okla.), a senior member of the House Appropriations Committee and a close ally of its chairman and the speaker.

According to a new New York Times/CBS poll, the country is divided almost evenly with 46 percent of all people answering that transgender people should use the bathroom corresponding to the gender with which they were born and 41 percent believing they should use the bathroom that corresponds to the gender with which they identify. There is a stark partisan divide, however: Two-thirds of Republicans and 66 percent of conservatives say that transgender people should use the restroom corresponding to their gender at birth, while 60 percent of Democrats and 71 percent of liberals say they should be able to use the restroom with which they identify.

Democrats said many Republicans would regret votes that could be viewed as discriminatory toward the LGBT community, singling out those who switched their votes on Thursday.

“These things are going to be remembered,” Maloney said, likening the votes to being on “the wrong side of the march toward Selma” and “standing in the schoolhouse door” to prevent the integration of schools. He said the lawmakers who switched their votes Thursday would “have this hung around their necks for the rest of their careers.”

Paul Kane contributed to this report.