In the closely watched Masterpiece Cakeshop case, the Supreme Court dealt a blow against the small-mindedness that so often characterizes the self-appointed minders of social justice in America.

The case involved a Christian baker in Colorado named Jack Phillips who refused to create a wedding cake for a same-sex couple in 2012. The couple, Charlie Craig and Dave Mullins, reacted in characteristic 21st-century-American style — they filed charges. They took their complaint to the Colorado Civil Rights Commission under a state law forbidding discrimination on the basis of sexual orientation.

Jack Phillips lost before the Commission, lost before an administrative law judge and lost before the Colorado Court of Appeals. It fell to the Supreme Court to vindicate him, and none other than Justice Anthony Kennedy, who previously authored the national right to gay marriage, did it.

In his majority opinion, Kennedy honed in on the blatant bias of Colorado’s bias police, who apparently blanch at anything that doesn’t accord with their blinkered, thoughtless progressivism.

Phillips was on the wrong side of history, and so his rights could be disregarded and trampled. The arc of the moral universe bends toward crushing all resistance.

Phillips is an unlikely totem of hate. He’s happy to serve gay couples.

As he told Craig and Mullins, “I’ll make your birthday cakes, shower cakes, sell you cookies and brownies, I just don’t make cakes for same-sex weddings.”

Yet, once Phillips was thrown before the Civil Rights Commission, he didn’t have a chance. Commissioners opined that he was welcome to his religious beliefs, just not to bring them into his business. One commissioner said that “freedom of religion has been used to justify all kinds of discrimination throughout history, whether it be slavery, whether it be the Holocaust.”

Yes, religious freedom has much to answer for.

At the same time that the commission said Phillips couldn’t decline to bake a cake that violated his conscience, it upheld the right of bakers to refuse to bake cakes bearing anti-gay-marriage messages. The Colorado Civil Rights Commission is all in favor of conscience rights — so long as it agrees with your conscience.

Kennedy ruled for Phillips on fairness grounds, but avoided the more fundamental question of whether he had a First Amendment right to refuse to bake the cake. The answer to this seems simple: Yes, of course.

As Clarence Thomas pointed out in a concurring decision going further than Kennedy, making a wedding cake is a considerable creative undertaking for Phillips. It involves “sketching the design out on paper, choosing the color scheme, creating the frosting and decorations, baking and sculpting the cake, decorating it, and delivering it to the wedding.”

If nude dancing is considered expressive conduct, surely this should be.

Working with Phillips isn’t like picking a cake out of a freezer at Carvel. Thomas again: “He sits down with each couple for a consultation before he creates their custom wedding cake. He discusses their preferences, their personalities, and the details of their wedding to ensure that each cake reflects the couple who ordered it.” Then, he delivers it, and sometimes stays to mingle.

Other Christian bakers don’t draw the line in the same place that Phillips does on gay weddings, but there’s no doubt that he is sincere. He also refuses to bake Halloween cakes or cakes containing alcohol.

As Thomas points out, it would be very odd for the Supreme Court to protect the right of members of the Westboro Baptist Church to carry signs saying, “God hates fags,” and the right of the Ku Klux Klan to burn 25-foot crosses, and yet rule that Phillips can’t politely decline to bake a cake.

The Court will eventually have to return to this topic. But for now, it’s done the right thing — any day that officious bureaucrats who want to chase religion from the public square are slapped down is a good day for America.