WASHINGTON — The U.S. Supreme Court on Monday took the side of a Colorado baker who refused to make a wedding cake for a gay couple because of his own religious objections to same-sex marriage.

But the nature of the 7-2 ruling in favor of Jack Phillips, owner of Masterpiece Cakeshop in Lakewood, left open the question of how much precedent the decision would have on future clashes between religion and civil rights — as a great deal of the carefully weighed decision focused on the actions of Colorado officials involved in the legal fight rather than an overarching ideological dispute.

Writing for the majority, Justice Anthony Kennedy criticized the actions of the Colorado Civil Rights Commission, which in 2014 ruled as discriminatory Phillips’ refusal to create a custom wedding cake for fiancés Charlie Craig and David Mullins. The decision came with mandatory penalties.

Kennedy — who raised similar concerns about the panel when the case was argued in December — wrote that Phillips did not get a fair shake before the commission, which he described as “neither tolerant nor respectful of his religious beliefs.”

Kennedy added that some of the commissioners “disparaged Phillips’ faith as despicable” and “compared his invocation of his sincerely held religious beliefs to defenses of slavery and the Holocaust.”

Because of that, his opinion concluded, when the “Colorado Civil Rights Commission considered this case, it did not do so with the religious neutrality that the Constitution requires.”

But Kennedy, who was behind the landmark 2015 Obergefell v. Hodges decision that legalized same-sex marriage, also tried to make clear that the decision is not all-encompassing.

“The outcome of cases like this in other circumstances must await further elaboration in the courts, all in the context of recognizing that these 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,” he wrote.

Christopher Jackson, an attorney at the Denver law firm of Sherman & Howard who focuses on appeals cases, said all of these factors add up to what could be described as a narrow ruling.

“The court could have resolved a much broader and significant issue about resolving disputes between gay rights and religious objections,” Jackson said. “Instead of doing that, they did a very narrow ground in which they could get substantial agreement within the court.”

“It’s sort of anti-climatic,” he added. “It doesn’t address the issue that everyone thought it was going to address.”

The origin of the high-stakes legal battle was Phillips’ refusal in 2012 to design and bake a wedding cake for Craig and Mullins.

After the couple was denied, they filed discrimination charges with the Colorado Civil Rights Commission, which agreed with Craig and Mullins. The Colorado Court of Appeals did, too, but Phillips pressed his case until the Supreme Court agreed almost a year ago to take the case.

For Phillips, the decision was a cause for celebration. At work Monday, he was busy trading hugs with customers as he roamed the store. Phones were ringing off the hook.

“I’m profoundly thankful that the court saw the injustice that the government inflicted on me,” he said in a statement. “This is a great day for our family, our shop, and for people of all faiths who should not fear government hostility or unjust punishment.”

Outside the store, Marie Sautter Damm and her husband, Richard Damm, sat at a table eating some of Phillips’ brownies.

Six years ago, following the original suit filed by Craig and Mullins, Richard Damm drove down from Highlands Ranch to purchase a cake in support of Phillips.

“I specifically drove out to buy a cake that I didn’t need in support of Jack,” said Richard Damm.

Monday, the couple returned on their way to Breckendridge to show their support once again.

“It’s not about being anti-gay,” said Marie Damm. “People should have their religious rights. Too long in my life I’ve been keeping my mouth shut – but no more. I don’t have to agree with you for you to have your own rights.”

Attorney Kristen Waggoner, who represented Phillips before the Supreme Court, said in a press call Monday that the decision in his favor echoed a 2017 ruling by the high court that found that religious institutions could receive government money for nonreligious needs — in that case a grant to resurface a playground in Missouri.

“The court is constantly telling the government that you cannot treat people of faith differently than others in the marketplace,” said Waggoner of the conservative group Alliance Defending Freedom.

The two justices who dissented from the majority were Ruth Bader Ginsburg and Sonia Sotomayor.

In their dissent, Ginsburg wrote that the actions of the Colorado Civil Rights Commission should not have played such an outsized role in the final decision.

In questioning the panel’s neutrality, Kennedy cited the comments of one commissioner who said in one 2014 meeting that freedom of religion has been used to “justify all kinds of discrimination throughout history, whether it be slavery, whether it be the Holocaust.”

Countered Ginsburg: “Whatever one may think of the statements in historical context, I see no reason why the comments of one or two commissioners should be taken to overcome Phillips’ refusal to sell a wedding cake to Craig and Mullins.”

Heidi Hess, who was on the Colorado Civil Rights Commission when the Masterpiece Cakeshop case was debated, took a similar tact.

“Largely, I’m disappointed at the court’s interpretation of some of the statements that were made by one or two commissioners in the course of the public hearing on the case,” said Hess, who served as the commission’s chair from June 2015 until she stepped down in January.

To her, the case was about two people who tried to buy a cake and were rejected because of their sexual orientation, which is “clearly prohibited” by the Colorado Anti-Discrimination Act, she said.

In an interview with The Denver Post, the couple at the center of the case — Craig and Mullins — said they were disappointed but undeterred.

“Throughout this journey we have met so many people in various contexts who have been discriminated against and we all have stood up as a community and, I think, really raise public awareness and kind of change some minds here and there,” Craig said. “It’s been worth it.”

Advocates with the ACLU, which backed the couple, argued the narrow ruling was far from a major setback.

“The baker may have won the battle but it lost the war,” said James Esseks, the director of the ACLU’s LGBT & AIDS Project. “The bakery got a get-out-of-jail-free card because of what the court thought of as misbehavior by the Civil Rights Commission, but that doesn’t mean they get to discriminate in the future. Not at all.”

The Denver Metro Chamber of Commerce was one of dozens of interested parties to submit a brief in the case. It argued that a decision in favor of Phillips could hurt same-sex couples who live in rural or exurban areas and who have limited options when it comes to bakers, jewelers and other businesses in the wedding industry.

“We have shared values in Colorado – we are inclusive, open, respectful and welcoming,” the chamber’s president and CEO Kelly Brough said in a statement. “Those values don’t change with the decision at the Supreme Court today.”

The case is Masterpiece Cakeshop, Ltd. v. Colorado Civil Rights Commission.