LONDON — Britain's Supreme Court on Wednesday reversed a lower court ruling and ruled that a bakery owned by a Christian family didn't discriminate against a gay customer when it refused to make a cake bearing a slogan supporting same-sex marriage.

Ashers Baking Co. in Northern Ireland refused in 2014 to make a cake iced with the "Sesame Street" characters Bert and Ernie and the phrase "Support Gay Marriage." The owners argued they shouldn't be forced to put messages on their products at odds with their Christian beliefs. The court agreed.

"In a nutshell, the objection was to the message and not to any particular person or persons," Judge Brenda Hale wrote in the unanimous decision. "It is deeply humiliating, and an affront to human dignity, to deny someone a service because of that person's race, gender, disability, sexual orientation or any of the other protected personal characteristics. But that is not what happened in this case."

The general manager of the bakery, Daniel McArthur, said he was relieved by the decision.

"I want to start by thanking God," he told reporters. "He has been with us during the challenges of the last four years."

The case was brought by the customer, gay rights activist Gareth Lee, and the Equality Commission for Northern Ireland. It received backing from the Rainbow Project, Northern Ireland's largest support organization for lesbian, gay, bisexual and transgender people.

The Rainbow Project expressed disappointment with the decision.

"We believe this is direct discrimination for which there can be no justification," director John O'Doherty said. "We will, however, take time to study this judgment by the Supreme Court to understand fully its implications for the rights of LGBT people to access goods, facilities and services without discrimination."

It wasn't immediately clear if the plaintiffs plan to appeal the ruling to the European Court of Human Rights.

FOLLOW NBC OUT ON TWITTER, FACEBOOK AND INSTAGRAM