(CNN) Christian bakers who refused to make a cake that supported same-sex marriage lost their appeal of the ruling that found they discriminated against the man who ordered the cake.

A Northern Ireland appeal court Monday upheld the 2015 ruling against Ashers Baking Company, saying it "had directly discriminated against Gareth Lee on grounds of sexual orientation by refusing to make a cake supporting same-sex marriage."

Lee had requested a cake featuring Muppets characters Bert and Ernie and a message in favor of same-sex marriage.

The bakery refused to make the cake because the message conflicted with the owners' Christian beliefs, they said. 

Related: Column: The Refused Wedding Cake and Rights of Religious Minorities

In court on Monday, judges rejected Ashers' appeal, adding that the bakery wouldn't be endorsing a message by agreeing to make the cake: "The fact that a baker provides a cake for a particular team or portrays witches on a Halloween cake does not indicate any support for either."

The judges also said that the bakery wouldn't have objected to a cake containing a message supporting heterosexual marriage or a general message supporting marriage.

Outside court, the general manager of Ashers Baking Company, Daniel McArthur, said the ruling undermines religious freedom and free speech.

"If equality law means people can be punished for politely refusing to support other people's causes, then equality law needs to change," he said.

Simon Calvert from The Christian Institute said in a statement that Ashers' refusal was never about Lee as an individual, but about the message he was promoting.

"The only reason Ashers Baking Company turned this order down is because to do otherwise, would be to involve themselves and their company in endorsing a highly political and controversial campaign to redefine marriage," Calvert said.

After emerging from court on Monday, Lee said he was "relieved but also very grateful to the Court of Appeal for the judgment."

He was joined by Michael Wardlow from the Equality Commission for Northern Ireland, who added that the ruling clarifies the law and will give people the confidence to not worry if the views they hold will conflict with an organization.

"The freedom to express a religious or political opinion has to be balanced in a mature society with law to protect those who are most vulnerable," he said.