WASHINGTON (CBS News) — 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.

READ MORE: Storm Watch: Evacuation Orders Issued for CZU Burn Zones in Santa Cruz County

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.

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

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.

Minority Whip Steny Hoyer (D-MD) makes a point on the House floor following the vote on an anti-LGBT discrimination amendment, May 19, 2016. (C-SPAN)

Minority Whip Steny Hoyer (D-MD) makes a point on the House floor following the vote on an anti-LGBT discrimination amendment, May 19, 2016. (C-SPAN)

READ MORE: Police Activity Temporarily Shuts Highway 17 Saturday Afternoon

“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.

MORE NEWS: Elon Musk, Tesla Super Fans Blast Biden Administration Move Toward Regulating Autopilot

© 2016 CBS Interactive Inc. All Rights Reserved.