Media playback is unsupported on your device Media caption Watch how the controversial case has unfolded

The Christian owners of a Northern Ireland bakery have won their appeal in the so-called "gay cake" discrimination case.

The UK's highest court ruled that Ashers bakery's refusal to make a cake with a slogan supporting same-sex marriage was not discriminatory.

The five justices on the Supreme Court were unanimous in their judgement.

The high-profile dispute began in 2014 when the bakery refused to make a cake with the slogan "Support Gay Marriage".

Media playback is unsupported on your device Media caption Daniel and Amy McArthur, who own Ashers Bakery in Belfast, arrive at the Supreme Court in London

The customer, gay rights activist Gareth Lee, sued the company for discrimination on the grounds of sexual orientation and political beliefs.

But the bakery has always insisted its objection was to the message on the cake, not the customer.

Ashers lost the case and the subsequent appeal, but on Wednesday the firm won its appeal at the Supreme Court.

The legal battle - which has lasted four-and-a-half years and has cost nearly £500,000 so far - has raised questions over equality and freedom of conscience.

Ashers bakery's general manager Daniel McArthur said he was delighted and relieved by the ruling.

"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," Mr McArthur said outside the court.

Mr Lee said the case had made him feel like a second-class citizen and that he was now concerned about "the implications for all of the gay community".

Image copyright Getty Images Image caption Gareth Lee has been supported throughout the legal action by the Equality Commission

"To me, this was never about conscience or a statement. All I wanted to do was to order a cake in a shop," he said.

Northern Ireland's Attorney General John Larkin welcomed the decision.

The Equality Commission for Northern Ireland, which has supported Gareth Lee's action against Ashers, said it would study the implications of the judgement carefully.

"There is a concern that this judgement may raise uncertainty about the application of equality law in the commercial sphere, both about what businesses can do and what customers may expect," said Dr Michael Wardlow, the organisation's chief commissioner.

'Most expensive cake in UK history'

By Mark Simpson at the Supreme Court in London

Questions will now be asked as to whether the Equality Commission was right to spend more than £250,000 of public money on this case.

DUP Ian Paisley MP said he has written to the Northern Ireland Secretary calling for a review of the organisation's funding.

The commission backed Mr Lee, who ordered the "gay cake" but was refused.

Four years later, the Supreme Court has ruled it was not a case of discrimination.

Ashers bakery has spent more £200,000 on the case. It is being paid by The Christian Institute, a charity and lobby group.

The cake at the centre of the dispute would have cost £36.50.

It has proved to be the most expensive cake order in UK history.

What is the row about?

Customer Gareth Lee requested a cake featuring the Sesame Street characters Bert and Ernie, iced with the message: "Support Gay Marriage."

His order was initially accepted at a branch of Ashers in Belfast city centre, but two days later the baking firm's head office contacted Mr Lee to say the firm would not make the cake.

Why did the bakers refuse?

The family-run baking company, based in County Antrim, has described the same-sex marriage slogan as "inconsistent" with its religious beliefs.

Image copyright Getty Images Image caption Daniel McArthur, pictured here with his wife Amy, said Ashers had served Mr Lee before, and would do so again

But it points out that the company's issue was with the slogan and not Mr Lee, claiming it would have refused the same order from a heterosexual client.

As he arrived outside the Supreme Court for the start of the case in May, Mr McArthur said: "We didn't say no because of the customer; we'd served him before, we'd serve him again.

"It was because of the message. But some people want the law to make us support something with which we disagree."

What has the court said and why?

In the court's judgement (case reference [2018] UKSC 49), president of the Supreme Court Lady Hale ruled that the bakers did not refuse to fulfil the order because of his sexual orientation.

"They would have refused to make such a cake for any customer, irrespective of their sexual orientation," she said.

Image copyright PA Image caption Ashers Baking Company is situated on Royal Avenue in Belfast

"Their objection was to the message on the cake, not to the personal characteristics of Mr Lee."

She added: "Accordingly, this court holds that there was no discrimination on the ground of the sexual orientation of Mr Lee."

What does this mean for the law?

When Mr Lee first took action against the firm, he said the bakery's actions left him feeling like a lesser person.

On Wednesday, the Supreme Court ruled that there was no political discrimination as well as no discrimination based on Mr Lee's sexual orientation.

"This conclusion is not in any way to diminish the need to protect gay people and people who support gay marriage from discrimination," said Lady Hale.

"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."

Five Supreme Courts justices travelled to Belfast earlier this year to hear the case.

What could the ramifications be?

Some will regard the ruling - that service providers of any religion, race or sexual orientation can refuse to endorse a message they profoundly disagree with - as a victory for freedom of expression and freedom of ideas, says BBC legal correspondent Clive Coleman.

The ruling now poses the question whether it would be lawful, for instance, for a bakery to refuse to make a bar mitzvah cake because the bakers' owners disagreed with ideas at the heart of the Jewish religion? What about a cake promoting "the glory of Brexit", "support fox hunting", or "support veganism"?

As a result of Wednesday's ruling, there are likely to be further cases in which services are refused on the basis of beliefs held by the service providers, adds our correspondent.