The Christian owners of a bakery at the centre of the so-called "gay cake" case expressed their "delight and relief" after winning a Supreme Court appeal over a claim that they had discriminated against a customer.
Five justices at the UK's highest court allowed a challenge by the McArthur family, who run Ashers bakery in Belfast, in a unanimous ruling in London.The legal action was originally brought by gay rights activist Gareth Lee, who claimed he had been discriminated against when the firm refused to make him a cake iced with the slogan "Support Gay Marriage".
Mr Lee initially won his case in the county court and then at the Northern Ireland Court of Appeal, but the McArthurs then challenged those rulings at a Supreme Court hearing in Belfast in May.
Speaking outside court after the ruling on Wednesday, the bakery's general manager, Daniel McArthur, who attended court with his wife Amy, said: "We're delighted and relieved at today's ruling.
"We always knew we hadn't done anything wrong in turning down this order.
"We're particularly pleased the Supreme Court emphatically accepted what we've said all along - we did not turn down this order because of the person who made it, but because of the message itself.
"I know a lot of people will be glad to hear this ruling today, because this ruling protects freedom of speech and freedom of conscience for everyone."
Controversy first flared when Mr Lee, a member of the LGBT advocacy group QueerSpace, ordered a £36.50 cake in 2014 featuring Sesame Street puppets Bert and Ernie for a private function marking International Day Against Homophobia.
His order was accepted and he paid in full but, two days later, the company called to say it could not proceed due to the message requested.
Mr Lee, who was supported by Northern Ireland's Equality Commission, was also present for the latest ruling in the case, which has attracted enormous attention.
Speaking to the media after the ruling was announced, he said: "To me, this was never about a campaign or a statement.
"All I wanted was to order a cake in a shop that sold cakes to order.
"I paid my money, my money was taken and then a few days later it was refused. That made me feel like a second-class citizen.
"I'm concerned not just for the implications for myself and other gay people, but for every single one of us."
In a brief statement announcing the court's decision, its president, Lady Hale, said the McArthur family hold the religious belief that "the only form of marriage consistent with the Bible and acceptable to God is between a man and a woman".
She said: "As to Mr Lee's claim based on sexual discrimination, the bakers did not refuse to fulfil his order because of his sexual orientation.
"They would have refused to make such a cake for any customer, irrespective of their sexual orientation.
"Their objection was to the message on the cake, not to the personal characteristics of Mr Lee or of anyone else with whom he was associated.
"The message on the cake would not just be for the benefit of gay people - but also for their families and friends and anyone who recognises the social benefits which the commitment involved in gay marriage can bring.
"Accordingly, this court holds that there was no discrimination on the ground of the sexual orientation of Mr Lee or anyone else with whom he was associated."
The court also found that Mr Lee had no claim against Ashers on the grounds of religious belief or political opinion, holding that no-one should be "forced to have or express a political opinion in which he does not believe".
Lady Hale said: "The bakers could not refuse to supply their goods to Mr Lee because he was a gay man or supported gay marriage, but that is quite different from obliging them to supply a cake iced with a message with which they profoundly disagreed."
After announcing that the bakery's appeal was allowed, she added: "This conclusion is not in any way to diminish the need to protect gay people and people who support gay marriage from discrimination.
"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, religion or belief. But that is not what happened in this case."
Northern Ireland is the only part of the UK or Ireland where same-sex marriage is outlawed, with Prime Minister Theresa May's DUP allies staunch opponents of changing the law.
Mr Lee said he is considering his options regarding an appeal to the European Court of Human Rights.