WASHINGTON, D.C. — Justice Anthony Kennedy, the Supreme Court’s longtime swing vote, seemed especially torn on Tuesday about whether a religious Colorado baker should have to make a wedding cake for a same-sex marriage.

If the court rules in favor of the baker, who turned the gay couple away, bakeries could put signs in their windows that read, “We do not bake cakes for gay weddings,” Kennedy worried.

But he also thought the state of Colorado, which said the baker had to make cakes for everyone, should be more tolerant of his religious freedom.

Those conflicting ideas set the mood during oral arguments Tuesday in a case that pits the right to freedom of speech and religious expression against the right not to be discriminated against. The arguments were overrun with messy hypotheticals about hair stylists, Mexican restaurants, and Michelangelo, and Kennedy, who experts predict will decide the case, was critical of both sides.

The conflict originated in a Lakewood, Colorado bakery, Masterpiece Cakeshop, in 2012 when owner Jack Phillips refused to make a wedding cake for Charlie Craig and Dave Mullins without discussing the specifics of the cake at all. The state of Colorado decided that Phillips was violating the state’s civil rights law, which prohibits businesses from discriminating on the basis of sexual orientation. Phillips appealed, and the Supreme Court agreed to hear his case this year.

Kennedy’s concerns

During oral arguments on Tuesday, Kennedy questioned whether a win for Masterpiece would let bakers advertise that they don’t do business with gay couples — alluding to “Whites Only” signs in the segregation era.

“If you prevail, could the baker put a sign in his window, ‘We do not bake cakes for gay weddings?’” Kennedy asked U.S. Solicitor General Noel Francisco, who argued in favor of the baker on behalf of the Department of Justice. “And you would not think that an affront to the gay community?”

Several justices also asked repeatedly how this case was any different from refusing service to people because of their race.

At the same time, Kennedy took issue with a 2014 statement by a Colorado civil rights commissioner that freedom of religion “is one of the most despicable pieces of rhetoric” that people can use “to hurt others.”

“Tolerance is essential in a free society. And tolerance is most meaningful when it’s mutual. It seems to me that the state in its position here has been neither tolerant nor respectful of Mr. Phillips’ religious beliefs,” Kennedy said.

If the justices rule in favor of the gay couple, they’d be holding the right not to be discriminated against over the bakers’ free speech and freedom of religion rights. That would also bolster the court’s 2015 ruling legalizing gay marriage. If the justices rule in favor of the baker, however, more businesses could turn away LGBTQ people based on their religious freedom and free speech rights.

Are cakes art?

Phillips’ argument centers on his claim that cakes are art, and the government can’t infringe upon his First Amendment rights by forcing him to make art that’s against his beliefs. In fact, he closed the wedding cake side of his shop — 40 percent of his business — so that he doesn’t have to serve wedding cakes to gay couples until the Supreme Court’s decision, which is expected in June.

On Tuesday the Supreme Court’s liberal justices questioned where the baker’s lawyers would draw the line when determining what counts as art in similar cases — and who else would be able to turn certain customers away.

“Who else ‘speaks’ at a wedding?” Justice Ruth Bader Ginsburg asked. “Who else is an artist? Say the person who does floral arranging, owns a floral shop — would that person also be speaking at the wedding? How about the person who designs the invitation?”

Justice Elena Kagan piled on: “So the jeweler? Hair stylist? Why is there no speech in creating a wonderful hairdo? The makeup artist? It’s called an artist. Why wouldn’t that also count?”

Dozens of people spent days sleeping outside the court to get a seat at Tuesday’s hearing, most anxious to see what Kennedy would say. LGBTQ rights groups, religious freedom advocates and court-watchers were hoping Kennedy would give a sign as to which way he was leaning.