A conservative replacement on the Supreme Court for late Justice Ruth Bader Ginsburg, who died Friday, could provide a major boost to religious rights while threatening years of advancements for the LGBTQ community, legal experts and activists say.

In cases spanning same-sex marriage rights to workplace protections, the Supreme Court has in recent years delivered landmark victories to gay and transgender Americans. But these watershed rulings have also left unresolved the polarizing conflict between those who want to safeguard religious rights and those who want to expand LGBTQ protections.

Ginsburg not only played a critical role in voting in favor of LGBTQ rights but also voted to keep religious exemptions within narrow boundaries, said David B. Cruz, Newton Professor of Constitutional Law at the University of Southern California Gould School of Law. Her absence, and her replacement by a conservative justice, could help tip the scale toward curtailing LGBTQ rights.

“It’s going to be a continuing refinement of the line where religious freedoms prevail and where anti-discrimination protections prevail,” said Paul Smith, a professor at Georgetown Law School who argued the landmark 2003 Supreme Court case Lawrence v. Texas, in which the court ruled that laws prohibiting private activity between consenting gay adults are unconstitutional.

The court has already ruled in favor of religious exemptions in two major cases this summer. A group of nuns won its case regarding contraception and the Affordable Care Act, and the justices granted a “ministerial exception” that protects religious organizations from some lawsuits.

In November, the Supreme Court will hear a case on whether the city of Philadelphia can exclude a Catholic agency that does not work with same-sex couples from the city’s foster-care system. The city said Catholic Social Services defied its nondiscrimination policy. The agency and some foster parents sued Philadelphia, saying the decision violated their First Amendment rights of free speech and freedom of religion.

Catholic Social Services asked the court to use the case to reconsider a precedent limiting First Amendment protections for religious practices. That precedent, Employment Division v. Smith in 1990, ruled that certain laws could not be challenged through the First Amendment’s protection of the free exercise of religion.

The 1990 Smith decision has been unpopular among conservative Christians, and it led to the bipartisan congressional Religious Freedom Restoration Act in 1993. Overturning the 1990 Smith precedent could have implications for future cases, such as ones where wedding vendors cite their religious convictions as a reason to decline services to LGBTQ people, said Michael Moreland, a law professor at Villanova University.

“It could breathe new life into free exercise claims,” Moreland said.

In June, Justice Neil M. Gorsuch and Chief Justice John G. Roberts Jr. joined the court’s liberals in a 6-to-3 ruling that gay and transgender workers were covered under a federal law prohibiting sex discrimination in the workplace. One of the plaintiffs in the case was Aimee Stephens, a transgender woman who worked for years at a Michigan funeral home before being fired after informing the owners and colleagues of her gender transition.

In the court’s opinion in the case, Bostock v. Clayton County, Gorsuch said the decision was narrow — “we do not purport to address bathrooms, locker rooms, or anything else of the kind” — and that there might be constitutional protections or other federal laws shielding religious employers. “How these doctrines protecting religious liberty interact with Title VII are questions for future cases too,” he wrote, referring to the federal law that prohibits sex discrimination.

Gorsuch’s targeted approach, however, has not stopped lower courts from relying on the ruling to transform the nation’s legal landscape on issues beyond the workplace, including cases pertaining to bathrooms for transgender students and health-care protections for transgender patients. These issues are likely to come before the Supreme Court again, and a 6-to-3 conservative majority could help dilute the impact of the Bostock ruling, some LGBTQ advocates say.

“The court left a loophole big enough to destroy equality,” said Kristen Browde, co-chair of the National Trans Bar Association. How the court interprets religious exemptions “is going to be critical to whether the victory in Aimee Stephens’s case is truly complete,” Browde said.

Kim Colby of the Christian Legal Society said that the Bostock decision set off alarm bells among religious conservatives, but it also created room for opportunity.

“The case recognized that religious freedom could be an issue going forward, but it left open what would happen,” Colby said. “With a 5-4 court, no one takes anyone for granted. A 6-3 would make people feel more comfortable.”

Many religious conservatives have been disappointed by decisions from Roberts, she said, such as how he sided with liberal justices on whether churches were unfairly treated in Nevada because of coronavirus restrictions. Colby said religious conservatives will be watching whether transgender bathroom access becomes more widespread and whether religious institutions will be pressured to comply.

“Whatever happens with Justice Ginsburg’s seat does not mean one side is going to win or one side is going to lose automatically,” she said.

Sharon McGowan, legal director of the LGBTQ civil rights organization Lambda Legal, said the group was particularly concerned about one of Trump’s top picks to replace Ginsburg, Amy Coney Barrett. When Barrett was nominated for the Seventh Circuit Court of Appeals in 2017, Lambda Legal wrote a letter opposing her nomination, citing her decision to deliver a lecture paid for by the conservative Christian organization Alliance Defending Freedom as well as a letter she signed publicly supporting “marriage and family founded on the indissoluble commitment of a man and a woman."

While the landmark 2015 Supreme Court case Obergefell v. Hodges established a constitutional right to same-sex marriage, Lambda Legal continues to litigate cases involving the rights of gay couples, including the citizenship rights of children born abroad to same-sex U.S. citizen couples and the right to survivor’s benefits for surviving same-sex partners who were barred from marrying as a result of state marriage bans.

In his Obergefell opinion, Roberts said the decision created “serious questions about religious liberty,” and courts are still ruling on cases on what to do when LGBTQ rights bump up against religious protections.

In 2017, Gorsuch joined Justices Clarence Thomas and Samuel A. Alito Jr. in dissenting a ruling that states may not treat married same-sex couples differently from others in issuing birth certificates.

“Marriage equality, while it should be a settled issue, is still very much something we are fighting to secure,” McGowan said.

But Paul Smith, the Georgetown professor, is less worried that a conservative replacement for Ginsburg could help erode the impact of the Obergefell case, not only because of the hundreds of thousands of Americans that have already married same-sex partners but also because of the way Gorsuch and Roberts ruled in the Bostock case.

University of Virginia law professor Douglas Laycock, who is an expert on religious liberty, agreed that constitutional protection for same-sex marriage is seen as a done deal.

“Gay rights might be surprisingly safe, except for those who view every religious exemption as a defeat for the LGBT community,” Laycock said. The Supreme Court "may not expand constitutional protection for gay rights any further, but there is not much left to strike down.”