DENVER (Reuters) - A baker in suburban Denver cannot cite his religious beliefs in refusing to make a wedding cake for a gay couple, the Colorado Court of Appeals ruled on Thursday, backing a lower court that decided he had illegally discriminated against the two men.

The decision follows a landmark U.S. Supreme Court ruling in June that legalized gay marriage nationwide.

David Mullins and Charlie Craig had said it was "offensive and dehumanizing" when Masterpiece Cakeshop owner Jack Phillips told them his Christian beliefs prevented him from baking the cake when they visited his business in 2012.

The couple was wed in Massachusetts but wanted to celebrate their nuptials with friends in Colorado. At the time, Colorado allowed civil unions but did not permit marriage between same-sex couples.

The American Civil Liberties Union filed a complaint on behalf of Mullins and Craig, and in December 2013 Administrative Law Judge Robert Spencer found that the baker had violated a state law barring discrimination at public accommodations based on race, gender or sexual orientation.

Phillips countered that requiring his business to provide such a cake violated his rights to freedom of speech and the free exercise of religion.

The Colorado Civil Rights Commission affirmed Spencer's decision and required the cake shop to take remedial measures including comprehensive staff training and the filing of quarterly compliance reports. Phillips appealed.

In its opinion on Thursday, a three-judge panel of the Colorado Court of Appeals said the state's Anti Discrimination Act, known as CADA, clearly prohibits businesses from refusing to serve customers based on their sexual orientation.

It said the bakery had argued that wedding cakes inherently convey a celebratory message about marriage, and that the commission's order therefore conflicted with the baker's beliefs.

"We disagree," the appeals court wrote.

"Nothing in the record supports the conclusion that a reasonable observer would interpret Masterpiece's providing a wedding cake for a same-sex couple as an endorsement of same-sex marriage rather than a reflection of its desire to conduct business in accordance with Colorado's public accommodations law," it added.

It said the bakery remains free to continue espousing its beliefs, including opposition to gay marriage.

"However, if it wishes to operate as a public accommodation and conduct business within the State of Colorado, CADA prohibits it from picking and choosing customers based on their sexual orientation," the court wrote.