The Supreme Court sided with a baker who has religious objections to same-sex couples' weddings in a narrow decision on Monday morning.

The long-awaited decision in the Masterpiece Cakeshop case, however, mostly avoided the hot-button question of whether civil rights laws could lead to an order that the baker, Jack Phillips, make a wedding cake for such couples.

Instead, Justice Anthony Kennedy's decision for the court only drew dissents from two justices by focusing on the fact that, as he put it, Phillips was treated with "hostility" by Colorado's Civil Rights Commission — action that the Supreme Court ruled violates the First Amendment's Free Exercise Clause.

Reading his decision from the bench, Kennedy said that when the Colorado Civil Rights Commission considered the Masterpiece Cakeshop matter, "it did not do so with the religious neutrality that the Constitution requires."

On that narrow ruling, only Justices Ruth Bader Ginsburg and Sonia Sotomayor disagreed.

Charlie Craig and Dave Mullins, a same-sex couple who were seeking a wedding cake, filed a discrimination complaint against Phillips in 2012 when he told them he does not create such cakes for same-sex couples. The Colorado Civil Rights Commission eventually sided with the couple, ordering Masterpiece Cakeshop and Phillips to "cease and desist from discriminating against ... same-sex couples by refusing to sell them wedding cakes or any product [they] would sell to heterosexual couples."

In his decision, however, Kennedy wrote that the commission had crossed a line with its treatment of Phillips.

"Phillips was entitled to the neutral and respectful consideration of his claims in all the circumstances of the case," Kennedy wrote — consideration that "was compromised here." He went on to write that "[t]he Civil Rights Commission’s treatment of his case has some elements of a clear and impermissible hostility toward the sincere religious beliefs that motivated his objection."

He wrote that "hostility" to Phillips' religious beliefs was shown at the commission's hearings and in "the difference in treatment between Phillips’ case and the cases of other bakers who objected to a requested cake on the basis of conscience and prevailed before the Commission." The issue of "hostility to religion" was one that Kennedy had questioned the lawyer for the commission about during oral arguments this past fall.

At the same time, however, the court avoided a ruling on the larger question that had brought the parties — and the Trump administration, which backed Phillips — to the Supreme Court in the first place: whether Colorado's civil rights law could be held to order Phillips to bake a cake for a same-sex couple.

Kennedy spent much of his opinion laying out that it was possible that such a law could be upheld. While religious people and organizations are protected in the teaching of their faith, Kennedy wrote, "it is a general rule that such objections do not allow business owners and other actors in the economy and in society to deny protected persons equal access to goods and services under a neutral and generally applicable public accommodations law."

Here, however, that law was not neutrally implemented, the court ruled.

"[W]hatever the outcome of some future controversy involving facts similar to these, the Commission’s actions here violated the Free Exercise Clause," Kennedy wrote for the court, concluding that "[the commission's] order must be set aside."

Chief Justice John Roberts joined Kennedy's opinion in whole, and they were joined by two justices to their ideological left — Justices Stephen Breyer and Elena Kagan — and two other conservative justices — Justices Samuel Alito and Neil Gorsuch. Justice Clarence Thomas also joined Kennedy's opinion in part and agreed with the court's judgment.

Thomas wrote that "the discriminatory application of Colorado’s public-accommodations law is enough on its own to violate Phillips’ rights." Joined by Gorsuch, Thomas focused his writing on the free speech claims brought by Phillips, which were not addressed in Kennedy's opinion for the court.

"Phillips’ creation of custom wedding cakes is expressive," Thomas wrote. "The use of his artistic talents to create a well-recognized symbol that celebrates the beginning of a marriage clearly communicates a message" — meriting consideration of protection under the First Amendment.

Ginsburg, joined by Sotomayor, wrote to detail why the pair disagreed with Kennedy's decision.

Writing that she "strongly disagrees ... with the Court’s conclusion that Craig and Mullins should lose this case," Ginsburg went on to state, "The different outcomes the Court features [in other cases considered by the Colorado commission] do not evidence hostility to religion of the kind we have previously held to signal a free-exercise violation, nor do the comments by one or two members of one of the four decisionmaking entities considering this case justify reversing the judgment below."

Gorsuch, joined by Alito, wrote an opinion concurring with Kennedy's decision for the court, primarily to respond to Ginsburg's dissenting opinion. Noting their dissenting opinion, Gorsuch wrote that "respectfully, I do not see how we might rescue the Commission from its error."

Kagan, joined by Breyer, also wrote an opinion concurring with Kennedy's decision, primarily to respond to Gorsuch.

Chris Geidner is a reporter for BuzzFeed News and is based in Washington, DC.