Religious liberty was among the primary concerns that ultimately defeated controversial legislation aimed at enforcing a 2014 LGBT executive order twice this week.

If passed, the amendments could infringe upon religious liberty of federal contractors, critics say. Since the executive order does not have explicit protections for religious contractors, Catholic institutions could risk losing their contracts if they object to offering spousal benefits for same-sex partners or permitting individuals to use the bathroom that does not align with their biological sex.

The amendment in question, inserted by Rep. Sean Patrick Maloney (D-N.Y.), would bar federal money from any federal contractor who makes employment decisions “on the basis of sexual orientation or gender identity.” It is meant to enforce President Barack Obama’s executive order that forbade contractors from making such employment decisions.

After the amendment initially had the 213 votes needed to be included in a large defense spending bill last week, GOP leadership held the vote open for a few more minutes and persuaded several members to switch their votes, enough to kill the amendment.

A week later, Rep. Maloney inserted another such amendment into an energy and water spending bill. It was approved Wednesday evening.

However, Rep. Joe Pitts (R-Penn.) attached an amendment of his own clarifying that Maloney’s amendment would be limited by the First and Fourteenth Amendments and Article I of the Constitution. Essentially, contractors would be ensured First Amendment protections in choosing not to hire someone because of their behavior, and the government could not terminate the contract purely because of that employment decision.

Another amendment by Rep. Bradley Byrne (R-Ala.) established religious freedom protections: it forbade “the use of funds in contravention of the Religious Freedom Restoration Act of 1993.”

Then on Thursday, the spending bill failed as 305 House members — both Democrats and Republicans — voted against it. Many Democrats reportedly opposed the bill because of several other amendments attached.

President Obama’s 2014 executive order was staunchly opposed by leading U.S. bishops who said it would infringe upon the rights of religious contractors to make employment decisions consistent with their religious beliefs.

Two bishops — Archbishop William Lori of Baltimore, chair of the U.S. Bishops’ Conference ad hoc committee on religious liberty and Bishop Richard Malone of Buffalo, chair of the bishops’ family life committee — expressed grave concerns about the order after it was issued, calling it “unprecedented and extreme” and saying it discriminated against religion.

The bishops insisted that “the Church strongly opposes…unjust discrimination against those who experience a homosexual inclination.”

However, they stressed, the order not only forbade contractors from making employment decisions based on someone’s sexual “inclination,” but also on their “behavior.” Thus, employers whose “policies or practices reflect religious or moral objections to extramarital sexual conduct” would not be able to contract with the government.

As for the order’s prohibition on “‘gender identity’ discrimination,” it was wrong on both “principle” and “practice,” the bishops said.

It was wrong on principle because it treated gender as “nothing more than a social construct or psychological reality” that someone could choose rather than something grounded in biological fact, the bishops said. It was also wrong in practice because it could lead to invasions of privacy like a “biological male employee” using the “women’s restroom or locker room,” they added.