If wedding cakes are expressive, whether by words or mere festive design, what’s their message? We can tell by their context since, as the court notes, a symbolic item’s context “may give meaning to the symbol.” Thus, the court found that an upside-down flag with a peace sign carried an antiwar message — protected as speech — because of the context of its display. Likewise, a wedding cake’s context specifies its message: This couple has formed a marriage. When the specific context is a same-sex wedding, that message is one Mr. Phillips doesn’t believe and cannot in conscience affirm. So coercing him to create a cake for the occasion is compelled artistic speech.

Note that this argument wouldn’t cover all requirements to make artistic items. The law may force photographers to do photo portraits for Latinos as well as whites since that doesn’t yet force them to create art bearing an idea they reject, which is all the compelled-speech doctrine forbids. But custom wedding cakes carry a message specific to each wedding: This is a marriage.

Can Colorado justify its compulsion anyway? Some say yes: Fighting discrimination — disfavored conduct, not speech — is the general goal of Colorado’s public-accommodations law. And if that goal is legitimate, they continue, so is every application of this law.

Remarkably, given how commonly one encounters this answer, the court has explicitly considered and rejected it twice. In Hurley v. Irish-American Gay, Lesbian, and Bisexual Group of Boston (1995), the court held that while anti-discrimination laws do not “as a general matter” violate the First Amendment, they do when “applied in a peculiar way” that burdens speech. In that case and in Boy Scouts of America v. Dale (2000), the government said there was sexual-orientation discrimination, both times under its public-accommodations laws. The goal in both was to fight discrimination rooted in opposition to “homosexual conduct.” Still, the court said both times, this generic goal could not justify coercion that interfered with the content of anyone’s expression.

In these cases, after all, the precise act being targeted just is the speaker’s choosing (“discriminating”) among which ideas to express — exactly what the First Amendment exists to protect. As the court put it in Hurley, the “point of all speech protection” is “to shield just those choices of content that in someone’s eyes are misguided, or even hurtful.”

So to use the force of law to compel Mr. Phillips to create same-sex wedding cakes, Colorado must identify another goal. Is it to ensure that all couples have access to a cake? But they do: Colorado hasn’t even suggested otherwise. Choices like Mr. Phillips’s amount to a “handful in a country of 300 million people,” according to Andrew Koppelman, a constitutional scholar and gay-rights advocate.

The only claim left is that Mr. Phillips’s expressive choice causes what some refer to as dignitary harm: the distress of confronting ideas one finds demeaning or hurtful. Yet accepting that justification would shatter what the court in Texas v. Johnson (1989) called a “bedrock principle” — namely that “the government may not prohibit the expression of an idea simply because society finds the idea itself offensive.”

At some level, Colorado itself gets it. Three times the state has declined to force pro-gay bakers to provide a Christian patron with a cake they could not in conscience create given their own convictions on sexuality and marriage. Colorado was right to recognize their First Amendment right against compelled speech. It’s wrong to deny Jack Phillips that same right.