(JTA) — Seven Supreme Court justices sided with a Colorado baker in his legal fight with a gay couple. And eight major Jewish groups weighed in on the decision.

Six of the Jewish groups disagreed with the decision. But two Orthodox organizations dissented from the rest, calling the ruling a victory for religious freedom.

“Too many pundits and politicians have lately engaged in rhetoric that seeks to paint religious liberty in a negative light, especially as they seek to advance policies to which some have sincere dissent,” Nathan Diament, the Orthodox Union’s executive director for public policy, said in a statement. “Today, the United States Supreme Court sent a clear message: that the demonization of religious beliefs – especially in policymaking – is constitutionally unacceptable.”

The O.U. stance is significant because Jewish groups across the spectrum have long based their policy positions on a robust defense of religious freedom. For decades, that meant keeping religion out of the public square and promoting so-called “public accommodation” laws that require places open to the public to grant customers full and equal treatment. This was partly due to a fear that allowing religious exemptions would amount to a tacit government endorsement of Christianity.

But in recent years the O.U. has supported a number of efforts to allow more public religious expression, contending that expanding those rights would benefit religious Jews.

In Masterpiece Cakeshop v. Colorado Civil Rights Commission, the court ruled that a Colorado baker was allowed to refuse to bake a cake celebrating a same-sex marriage. The decision, published Monday, was relatively narrow: The baker was within his rights, Justice Anthony Kennedy wrote for the majority, because a member of the Colorado Civil Rights Commission had made comments hostile to his faith while initially ruling on the incident.

“[T]hese disputes must be resolved with tolerance, without undue disrespect to sincere religious beliefs, and without subjecting gay persons to indignities when they seek goods and services in an open market,” Kennedy wrote.

Conservative groups had hoped the ruling would be broader, allowing private businesses to refuse service to LGBT couples based on their religious beliefs. Liberal groups, likewise, hoped the court would ban such actions as illegal discrimination.

Liberal justices Stephen Breyer and Elena Kagan, who are Jewish, sided with the majority. Justices Ruth Bader Ginsburg and Sonia Sotomayor dissented, with Ginsberg saying that the majority opinion did not take fully into account the baker’s unwillingness to serve customers because of who they are.

The six Jewish groups opposing the decision, including the Anti-Defamation League and the Reform movement, are largely liberal. Their arguments all said the decision either effectively endorsed anti-LGBT discrimination or missed an opportunity to prohibit it.

“As Americans and as Jews, we affirm that discrimination is not ‘religious freedom,’ and pretending otherwise is an insult to those who have suffered religious persecution,” read a statement by Stosh Cotler, CEO of Bend the Arc, a liberal Jewish activist group. “We are relieved this decision was not the sweeping negative ruling it could have been.”

But the O.U. and Agudath Israel of America, employing similar ideas, reached the opposite conclusion: That the ruling strikes a blow against discrimination. Codifying the notion that the government cannot disparage religious groups, Diament told JTA, will be helpful to Jewish groups in the future.

“It’s crucial for Jews and for other minority communities that religious freedoms be given the strongest and widest scope,” he said in an interview Tuesday. “The intent of the policymakers is going to be taken into consideration when they’re evaluating a policy.”

A haredi Orthodox organization, Agudah praised the ruling for similar reasons, saying in a statement that it “emphasizes that religious freedom concerns must be given a full and deserving measure of consideration, even within the context of local and state anti-discrimination law.”

Diament said the ruling could aid Jewish groups, for example, if a government body tries to pass a bill outlawing Jewish practices like circumcision or ritual slaughter. In a case like that, the bill could be unconstitutional if its sponsors make comments disparaging Judaism or Islam.

“Those are things that are based in religion that some people view as politically incorrect and want to have restricted,” Diament said. “Religious liberty jurisprudence is what’s going to be essential to preserving those practices for the Jewish community in the United States.”

Diament also appreciated a passage in Kennedy’s opinion stating that “a member of the clergy who objects to gay marriage on moral and religious grounds could not be compelled to perform the ceremony without denial of his or her right to the free exercise of religion.” He said that sentence will protect Orthodox synagogues that decline to celebrate Jewish same-sex marriages.

Orthodoxy is the only major Jewish denomination that opposes same-sex marriage. The O.U. and Agudah criticized the 2015 Supreme Court decision legalizing such unions.

The O.U. generally favors public policies that allow for broader practice of religion. It supports government aid to private religious schools, as well as federal vouchers for private education. It likewise supported a bill this year providing federal security grants to religious nonprofits.