WASHINGTON, D.C. — The Supreme Court’s decision shielding LGBT people from employment discrimination dealt a blow to religious conservatives — and was penned by a justice they lauded after his nomination by President Donald Trump.

The court ruled 6-3 on Monday that prohibitions against sex-based job discrimination established in the Civil Rights Act of 1964 also protect gay, lesbian and transgender employees, in what was hailed by LGBT activists as a major victory.

Among the religious right, many found the majority opinion written by Justice Neil Gorsuch alarming. But some also saw an open door to gain back some ground in the future, as it left unresolved questions about potential religious exemptions that could affect the application of the civil rights statute.

Most religious conservatives stopped short of calling Gorsuch out by name, instead lamenting the ruling generally and warning it could encroach on employers’ ability to act according to their faiths.

Longtime evangelical conservative leader James Dobson said Tuesday in a statement that what he considers an “abhorrent decision” suggests the nation “is in the midst of a spiritual war over its very heart and soul.”

Rev. Franklin Graham, a leading pro-Trump evangelical, wrote on Facebook that the ruling “erodes religious freedoms,” adding: “Even if my sincerely held religious beliefs might be the minority, I still have a right to hold them. The same holds true for a Christian organization.”

Despite such cricitisms, conservative attorneys who focus on religious liberty note that the Supreme Court will soon face cases that could firm the ground for faith-based exemptions from the employment discrimination ruling.

One key test will come this fall, when it takes up the case of a Catholic foster agency in Philadelphia that saw its relationship with the city severed because it wouldn’t place children with same-sex families. The court is being asked to reexamine a 30-year-old decision that, if overturned, could create a broad religious exemption from generally and neutrally applicable laws.

“It’s clear that the court is interested in protecting religious liberty and is asking folks to raise these issues so the courts can decide them in the future,” said John Bursch, a senior counsel at the conservative Alliance Defending Freedom who argued one of the cases that was consolidated for this week’s ruling.

In the meantime, however, Bursch said that “the court has opened a Pandora’s box where all of that cultural friction between the assertion of LGBT rights and the assertion of religious liberty, which are supposed to be compatible, are going to be litigated in case after case.”

Another conservative religious freedom lawyer, Kelly Shackelford of the First Liberty Institute, said he was “grateful” to see the court’s majority opinion explicitly note that faith-based issues remained unaddressed.

“For those of us who commit ourselves fully to religious freedom, this is a helpful sign,” Shackelford said. “We’ll see if that’s a hollow promise or a truthful assurance of protection.”

Another possible path for religious conservatives to win faith-based exemptions would be through Congress, but a proposal that aimed to forge a compromise has not gained momentum in the divided legislature.

Republican lawmakers, while some decried the ruling, mostly refrained from pointing fingers at Gorsuch for his role in crafting the majority opinion.

Asked if he was disappointed in the Trump-nominated justice, Missouri GOP Sen. Josh Hawley told reporters only that “I was surprised at his method of reaching a conclusion” about the civil rights law’s applicability to discrimination against LGBT workers.

Hawley declared in a blistering Tuesday speech, however, that “the bargain that has been offered to religious conservatives for years now is a bad one. It’s time to reject it.” The former clerk for Chief Justice John Roberts said that religious conservatives have been asked to “go along with the party establishment” on policy matters and “keep our mouths shut” in exchange for judicial nominees “who supposedly will protect your constitutional rights to freedom of worship.”

Meanwhile, Trump struck a less-than-critical tone, saying that “some people were surprised” by the justices’ decision but “they’ve ruled, and we live with their decision.”

Some were vocally unhappy with Gorsuch, however. Albert Mohler, president of the Southern Baptist Theological Seminary, dinged the judge Tuesday for an opinion that “entangles himself in his own culpability for very flawed legal logic.”

Language in Monday’s majority opinion said the federal Religious Freedom Restoration Act could provide an opportunity for employers to claim religious liberty violations that the court was not asked to address in that case.

“It is interesting that the Supreme Court was able to stick together in the ruling because it basically bracketed those hard-fought questions about religious exemptions,” said Melissa Rogers, who served as a faith-based programs adviser to President Barack Obama and is now a visiting professor at the Wake Forest University School of Divinity.

With those questions still unanswered, University of Miami School of Law professor Caroline Mala Corbin said, there is still a possibility that Monday’s ruling will be undercut by an expansion of religious exemptions.

“I think religious conservatives feel empowered at this time to bring challenges to anti-discrimination laws,” she said.

AP writer Mary Clare Jalonick contributed to this report.