House GOP leadership on Thursday appeared to bend the rules to sink an amendment that would uphold President Barack Obama's executive order protecting LGBT workers in federal contracts.

The House floor turned chaotic as Democrats cried foul.

Amid shouts of “Shame! Shame!” from Democrats, seven Republicans were persuaded by GOP leaders to switch their votes after the clock had run out.

Out Rep. Sean Patrick Maloney, a Democrat from New York, proposed attaching the amendment to a spending bill following passage late Wednesday of a defense policy bill that included an amendment by Rep. Steve Russell, a Republican from Oklahoma, that would extend a “religious exemption” from the Civil Rights Act of 1964 to all government contractors.

The amendment's vague language “could be exploited as a license to discriminate against LGBT Americans by almost any federal contractor,” Rep. Richard Hanna, a Republican, told the Rules Committee on Tuesday.

The drama unfolded as Maloney's amendment appeared to pass 217-206, but Republican leaders held the vote open as they prowled the aisles looking to pick up votes to defeat the measure.

“Need two more votes,” Rep. Steve Russell said loudly among Republicans.

According to Slate, eight minutes passed before the gavel came down. Maloney's amendment was defeated with a narrow 213-212 vote.

“GOP leadership held the vote up until they convinced GOP colleagues to CHANGE their vote,” Maloney tweeted. “SHAME.”

Democrats quickly shared the names of Republicans who changed their votes: Reps. Darrell Issa, Jeff Denham, David Valadao of California; Greg Walden of Oregon; Bruce Poliquin of Maine; and David Young of Iowa.

Obama has threatened to veto the defense bill as it is currently drafted.