A Supreme Court ruling unrelated to LGBT rights will likely allow religious schools to discriminate against LGBT teachers.

In a 7-2 decision handed down Wednesday, the high court said that religious schools have an expansive ministerial hiring exemption under federal civil rights laws.

Writing for the majority, U.S. Associate Justice Samuel Alito wrote that the First Amendment allows religious institutions to make workplace decisions consistent with their religious beliefs – even if such actions would be considered discriminatory at a secular workplace under federal law.

“Judicial review of the way in which religious schools discharge those responsibilities would undermine the independence of religious institutions in a way that the First Amendment does not tolerate,” Alito wrote.

Plaintiffs in the consolidated case claimed age and disability discrimination.

The implications for LGBT teachers working at such schools are staggering. Only last month, the Supreme Court ruled that current federal civil rights law extends to LGBT workers. Wednesday's decision essentially carves out an exemption for religious schools.

The number of teachers fired because of their sexual orientation or gender identity has sharply increased since gay couples gained the legal right to marry. The Roman Catholic Church views gay relationships as sinful and has taken a strong stand against gay teachers who marry. In many instances, teachers in good standing for decades have been fired after quietly marrying their long-term partners.

According to New Ways Ministry, a group that advocates on behalf of LGBT Catholics, roughly 90 church workers “have lost their jobs in LGBT-related employment disputes” since 2007. While marriage equality arrived nationwide in 2015, gay couples in Massachusetts started marrying in 2004.