WASHINGTON (Reuters) - The U.S. Supreme Court on Tuesday appeared sharply divided in the closely watched case of a Christian baker who refused to make a wedding cake for a same-sex couple, with pivotal Justice Anthony Kennedy voicing concerns about endorsing discrimination against gay people but also about anti-religious bias.

The nine justices -- five conservatives and four liberals -- heard an intense, almost 90-minute argument in the dispute over whether certain businesses can refuse to serve gay couples if they oppose same-sex marriage for religious reasons.

The case involving Jack Phillips, a baker who runs Masterpiece Cakeshop in Denver’s suburb of Lakewood and turned away gay couple David Mullins and Charlie Craig in 2012, pitted Colorado’s anti-discrimination law against rights to freedom of speech and expression under the U.S. Constitution’s First Amendment.

Kennedy, an 81-year-old champion of gay rights and free speech who wrote the landmark 2015 ruling legalizing same-sex marriage nationwide, did not definitively indicate how he would vote in the ruling due by the end of June, posing tough questions to both sides.

He raised concerns about a decision siding with the baker that would give a green light to discrimination against gay people.

“It means that there’s basically an ability to boycott gay marriages,” said Kennedy, a conservative who sometimes sides with the court’s four liberals in major cases on divisive social issues.

The court’s liberals would likely side with him on that point, with several justices citing a range of other creative professionals who could deny service to gay customers if the baker wins, as some florists and wedding photographers already have done.

The baker’s lawyers at the conservative Christian advocacy group Alliance Defending Freedom argued that creating a custom cake is a form of free expression protected by the Constitution. Lawyers for Mullins and Craig said it the baker’s action was simply unlawful discrimination based on sexual orientation.

Liberal Justice Elena Kagan wondered about whether a hairstylist, chef or a makeup artist could refuse service, claiming their services are also speech protected by the Constitution.

Slideshow ( 15 images )

“Why is there no speech (rights) in creating a wonderful hairdo?” Kagan asked.

But Kennedy also asked whether the Colorado civil rights commission that concluded that Phillips had violated state law was biased against religion, which could indicate he could yet side with the baker.

Conservative members of the court, including Chief Justice John Roberts, appeared more sympathetic to the baker in one of the biggest cases of the court’s current nine-month term. Roberts asked whether a Catholic nonprofit organization providing free legal services should be forced to take on issues that conflict with its religious stances.

Phillips is appealing a state court ruling that he violated a Colorado anti-discrimination law that bars businesses from refusing service based on race, sex, marital status or sexual orientation.

‘AFFRONT TO THE GAY COMMUNITY’

Expressing his concerns about anti-gay discrimination, Kennedy mentioned the possibility of a baker putting a sign in his window saying he would not make cakes for gay weddings.

“And you would not think that an affront to the gay community?” he asked Solicitor General Noel Francisco, a lawyer for the Trump administration, which has backed Phillips.

Kennedy’s comments about the Colorado Civil Rights Commission’s handling of the case were more supportive of the baker. Kennedy said there was evidence of “hostility to religion” and questioned whether that panel’s decision should be allowed to stand.

Slideshow ( 15 images )

“Tolerance is essential in a free society. Tolerance is most meaningful when it’s mutual,” Kennedy said. But the commission was not “tolerant or respectful” of Phillips, he added.

Former commissioner Diann Rice said at a 2014 hearing that “freedom of religion, and religion, has been used to justify all kinds of discrimination throughout history, whether it be slavery, whether it be the Holocaust.”

Hundreds of demonstrators on both sides of the dispute rallied outside the white marble courthouse. Supporters of Phillips waved signs that read, “We got your back Jack.” As Mullins and Craig made their way into the courthouse, the two men led their supporters in chants of “Love Wins.”

After the arguments, Mullins told reporters the couple’s snub by Phillips made them feel mortified and humiliated, like “second-class citizens in our society.”

Mullins and Craig are represented by the American Civil Liberties Union, which has argued that Phillips’ legal team is advocating for a “license to discriminate” that could have broad repercussions beyond gay rights.

Phillips told reporters that the backlash against his business after his refusal has included death threats and harassment, adding, “We are struggling just to make ends meet and keep the shop afloat.”

“It’s hard to believe,” Phillips said, “that the government is forcing me to choose between providing for my family and my employees, and violating my relationship with God.”