A US court has ruled that a baker cannot cite religious beliefs as grounds for refusing to make a wedding cake for same-sex couple.

The Colorado Court of Appeals ruled on Thursday that the owners of a cake shop in suburban Denver had violated state law prohibiting discrimination based on sexual orientation.

The case had triggered debate between gay rights supporters and religious freedom advocates in the US.

Jack Phillips, owner of Masterpiece Cakeshop, declined to make a cake for Charlie Craig and David Mullins in 2012.

"Phillips believes that decorating cakes is a form of art, that he can honour God through his artistic talents, and that he would displease God by creating cakes for same-sex marriages," the court wrote in its decision.

Even so, the court backed a lower court that found that having to bake a cake for a gay wedding does not place an undue burden on Philips’s religious exercise, nor is it a violation of his right to free speech.

"The act of designing and selling a wedding cake to all customers free of discrimination does not convey a celebratory message about same-sex weddings," the justices wrote. "To the extent that the public infers from a Masterpiece wedding cake a message celebrating same-sex marriage, that message is more likely to be attributed to the customer than to Masterpiece."

Craig and Mullins sued Phillips in 2012 after he refused to make a cake that included a depiction of a rainbow, a symbol used by the gay movement.

Phillips' attorney, Jeremy Tedesco, said Phillips has sold cakes to gay couples and would have sold a cake to Mullins and Craig. But he added that forcing Phillips to create a custom cake for the couple would be comparable to an artist being forced to paint the Confederate flag against his beliefs.

"He won't create cakes celebrating Halloween, with anti-family and anti-American messages or racist symbols ... either," Tedesco said.

Phillips now faces fines if he refuses to make wedding cakes for gay couples.
Phillips' attorneys have said they would consider appealing to the US Supreme Court. 

Earlier this summer, another cake order stirred controversy in the US as debate raged about the Confederate flag - seen by some Americans as a symbol of white supremacy.

A customer in the state of Louisiana had his request for a Confederate flag rejected by a Walmart store, and instead ordered a cake containing the flag of the Islamic State of Iraq and the Levant (ISIL) group.

Walmart later apologised for baking the ISIL flag.

Source: Al Jazeera and agencies