'Gay cake' row in Northern Ireland: Q&A
The Supreme Court has ruled that a Northern Ireland bakery's refusal to make a cake with a slogan supporting same-sex marriage was not discriminatory.
Ashers Baking Company, based in County Antrim, was taken to court by a gay rights activist, assisted by Northern Ireland's Equality Commission.
Ashers lost the case and the subsequent appeal, but on Wednesday the firm won its final appeal.
BBC News NI looks at the background to the the long-running "gay cake" dispute.
What is the bakery at the centre of the case?
Ashers Baking Company was founded in Newtownabbey in 1992. Run by the McArthur family, the Christian-owned business operates six shops in Northern Ireland.
The bakery came to wider prominence in July 2014 when it emerged that it had declined an order in its Belfast branch from a gay rights activist.
He had wanted them to make a cake that included a slogan that said "support gay marriage" along with a picture of Bert and Ernie from Sesame Street, and the logo of the Queerspace organisation.
Northern Ireland is the only part of the UK that has not passed a law to introduce same-sex marriage
The cake was being commissioned for a civic event in Bangor, County Down, to mark International Day Against Homophobia and Transphobia.
Staff at the bakery passed the order to its head office, which considered it to be "at odds with our beliefs".
Another bakery agreed to accept the order.
What happened after that?
The customer who placed the order with Ashers complained to Northern Ireland's Equality Commission, and the watchdog took up the case, warning the company that it had allegedly discriminated against the man on the grounds of his sexual orientation.
The Equality Commission said it "raises issues of public importance regarding the extent to which suppliers of goods and services can refuse service on grounds of sexual orientation, religious belief and/or political opinion".
The commission has supported the man in taking his legal case alleging discrimination.
However, Ashers said it was "taking a stand" on the grounds of religious freedom. The bakery's stance was backed by the Christian Institute, which has been providing it with legal assistance.
How did Northern Ireland's politicians react?
The Democratic Unionist Party (DUP), led by Northern Ireland First Minister Peter Robinson, led the opposition at Stormont to the Equality Commission's case.
A DUP assembly member, Paul Givan, drafted a Private Member's Bill seeking to build a conscience clause into equality law in Northern Ireland.
This clause would allow businesses to refuse to provide some services if they clash with their strongly-held religious convictions.
Mr Givan said: "Christians do not feel there is space being made for their religious beliefs".
The Catholic Church said it supported the general objective of the DUP's move.
However, opponents of the bill, led by Sinn Féin, have pledged to block the clause if it ever reaches the stage of a vote at the Stormont assembly.
Sinn Féin says it has gathered enough support for a petition of concern, a mechanism that means the bill would need cross-community support and, therefore, would not pass into law.
What about the public reaction to the case?
Rival demonstrations were held in support of both sides in the case.
In January, thousands of people gathered at Belfast City Hall to protest over the DUP's conscience clause bill. The crowd was addressed by politicians from Alliance, Sinn Féin and SDLP, as well as community leaders.
Two days before the court hearing in Belfast, more than 2,000 people gathered at the city's Waterfront Hall venue to show their support for Ashers. Hundreds more supporters stood outside the venue and sang hymns.
The cake was intended as a gift, but what did the recipient say?
Andrew Muir, Northern Ireland's first openly gay mayor, was hosting last year's event where he was presented with a replacement cake.
While he was not directly involved in the legal action, the Alliance Party councillor made an intervention on the eve of the court case to call for mediation.
"Unfortunately it has pitched people of religious belief against lesbian and gay people and I think that's very sad. It's not the type of society that I want in Northern Ireland where we have that adversarial set-up," Mr Muir said.
When the case eventually ended up in court, what happened?
The court case in Belfast ran for three days in March 2015.
During the hearings, a lawyer for the bakery argued the issue was "the cake, not the customer".
One of the bakers, Karen McArthur, said she did not know Mr Lee was gay and it would not have mattered as they would not have been prepared to make a cake with a pro-gay marriage slogan for anyone.
However, Gareth Lee said he felt he was discriminated against.
He said that after ordering the cake and paying for it, only to be told two days later that his order had been rejected: "It made me feel unworthy, a lesser person."
While the debate leading up to the hearing had been often heated, the BBC's Mark Simpson found that in the courtroom it was a different story, and there was "no heckling, shouting or jeering".
"There was respect between the legal teams, politeness from the witnesses and a respectful atmosphere inside the courtroom, including the packed public gallery," he said.
What did the court decide?
The judge found in favour of Mr Lee, saying that as a business, Ashers was not exempt from discrimination law.
District Judge Isobel Brownlie said Ashers was "conducting a business for profit", and it was not a religious group.
The firm was found to have discriminated against Mr Lee on the grounds of sexual orientation as well as his political beliefs.
The judge said she accepted that Ashers has "genuine and deeply held" religious views, but said the business was not above the law.
Damages of £500 were agreed in advance by legal teams on both sides of the dispute.
Did the owners appeal?
In October 2016, the owners of the bakery lost their appeal against a ruling that their refusal to make a "gay cake" was discriminatory.
Appeal court judges said that, under law, the bakers were not allowed to provide a service only to people who agreed with their religious beliefs.
Reacting to the ruling, Daniel McArthur from Ashers said he was "extremely disappointed" adding that it undermined "democratic freedom, religious freedom and free speech".
The firm then took the case to the Supreme Court.