The House floor erupted Thursday into a tense, chaotic situation after an amendment to protect members of the LGBT community failed several seconds after it looked like it had enough votes to pass.

The amendment from Rep. Sean Patrick Maloney, D-New York, would have barred federal contracts to companies that discriminate against LGBT employees. It was an attempt to undo a provision inside a major defense bill the House passed a night earlier that would reverse President Obama's executive order extending anti-discrimination protections to federal contractors' LGBT employees. Democrats warned the provision will allow any federal contractor to discriminate against gay, lesbian and transgender people.

Maloney's amendment narrowly failed Thursday 212-213 after it looked like it was going to pass 217-206 a few seconds earlier. Republican leaders held open the vote and Democrats say Republicans twisted arms, pressuring members of their conference to switch their votes so that it would fail.

Before and after shots of @HouseGOP bully tactics that changed House votes in FAVOR of discrimination. #shame pic.twitter.com/EMokCKz5h1 — Jackie Speier (@RepSpeier) May 19, 2016

"Shame, shame, shame!" Democrats chanted on the House floor as Republicans changed their votes.

This was a simple up or down vote on discrimination - Republicans voted to discriminate. — Sean Patrick Maloney (@RepSeanMaloney) May 19, 2016

After it failed, House Democratic Whip Steny Hoyer, D-Maryland, appeared visibly angry and spoke on the floor, pointing out he never saw any Republicans come to the front of the chamber to change their votes.

Get Breaking News Delivered to Your Inbox

"I was standing in the well and no one came and no one had the courage to come into the well to change their vote, but notwithstanding that, the vote kept changing. Mr. Speaker, from a parliamentary perspective, how is that possible?" Hoyer said.

According to an aide to Hoyer, Republicans kept the vote open so that lawmakers could change their vote from their seats without approaching the front of the chamber.

Speaker Paul Ryan, R-Wisconsin, was already at his weekly press conference when the chaos erupted. He told reporters he didn't know whether GOP leaders whipped against the proposal.

House Minority Leader Nancy Pelosi, D-California, slammed her GOP colleagues, saying, "House Republicans are so committed to discriminating against LGBT Americans, that they broke regular order to force their Members to reverse their votes and support Republicans' bigotry."

Democrats immediately lashed out at Republicans on social media and many compared their colleagues to Donald Trump, the presumptive GOP presidential nominee.

Today @HouseGOP showed their unabashed bigotry. They are the same as @realDonaldTrump — Steve Israel (@RepSteveIsrael) May 19, 2016

House GOP shows their true colors. They support hate and are one in the same with their leader @realDonaldTrump. https://t.co/EVLkzSxo9I — Rep. Dan Kildee (@RepDanKildee) May 19, 2016