"Shame, shame, shame!" Democrats in the House of Representatives chanted as Republicans switched their votes to block a measure that would have overturned an anti-LGBTQ measure passed on Wednesday.

The anti-LGBTQ measure, known as the Russell Amendment, after the Republican congressperson who proposed it, was included in the National Defense Authorization Act, a spending bill for the Department of Defense passed by the House late Wednesday. It's unclear if the Senate will pass the bill as is.

Related How most states allow discrimination against LGBTQ people

According to religious liberty expert Douglas Laycock, the Russell Amendment will likely allow some federal contractors to cite their religious beliefs to discriminate against LGBTQ people. The amendment effectively applies broad "religious liberty" exemptions to an executive order signed by President Barack Obama in 2014, which banned federal contractors from discriminating on the basis of sexual orientation and gender identity.

Specifically, the Russell Amendment applies to "any religious corporation, religious association, religious educational institution, or religious society" that receives a federal contract. But the measure doesn't define what constitutes a "religious" group, leading LGBTQ advocates to fear that practically any contractor could use a religious justification to discriminate.

Rep. Sean Patrick Maloney, a New York Democrat, attempted to overturn the measure with his own amendment on Thursday. But after it looked like Maloney's amendment would win, the House leadership refused to bring down the gavel until Republican members of the House could convince several of their colleagues to switch their votes in opposition — leading to the "shame, shame, shame" chant.

It was a dramatic scene. But it also offers a reminder of how flimsy nondiscrimination laws are for LGBTQ people. Because the federal government — and most states — does not explicitly ban discrimination on the basis of sexual orientation or gender identity in the workplace, President Obama had to resort to an executive order to get protections for LGBTQ people hired by federal contractors. But LGBTQ workers remain otherwise unprotected, at least explicitly, under federal and most states' law.

As a result, workplace discrimination remains a common problem. For example, a 2014 study from Freedom to Work and the Equal Rights Center found better-qualified LGBTQ applicants were 23 percent less likely to get a call back from some federal contractors than applicants who don't openly identify as LGBTQ.

LGBTQ advocates have tried to change this, including by lobbying for Obama to sign his executive action in the lead-up to 2014. But conservative and religious critics of LGBTQ nondiscrimination protections have tried to poke holes in the measures through broad exemptions for "religious liberty." The Russell Amendment is just the latest example of the conservative opposition's tactic.

For more on LGBTQ nondiscrimination laws, read Vox's explainer.

Watch: How most states allow discrimination against LGBTQ people