The tragic case of a 23-month-old boy who died after spending more than a year in hospital attracted widespread media attention.
Alfie Evans's parents had been fighting to take the toddler to Rome for further treatment, but a court ruled his life support could be turned off several days ago.
Here is how the story unfolded.
Who was Alfie Evans?
Alfie was born to parents Tom Evans and Kate James, from Bootle in Merseyside, on 9 May 2016.
He was first admitted to Alder Hey Children's Hospital in Liverpool in December 2016 after suffering seizures and has been a patient in the hospital ever since.
Doctors diagnosed a degenerative neurological condition, which they have not been able to identify definitively.
Alfie's parents and the hospital clashed over what should happen to Alfie, who had been in a semi-vegetative state for more than a year.
His parents said they wanted to fly him to a hospital in Italy but this was blocked by Alder Hey, which said continuing treatment was "not in Alfie's best interests".
Why did his case go to court?
The Alder Hey Children's Hospital NHS Foundation Trust went to the High Court to seek a declaration that "continued ventilator support is not in Alfie's best interests and in the circumstances it is not lawful that such treatment continue".
Sitting at the High Court in Liverpool, Mr Justice Hayden began overseeing the case on 19 December.
Alder Hey said scans showed "catastrophic degradation of his brain tissue" and that further treatment was not only "futile" but also "unkind and inhumane".
But his parents disagreed and wanted permission to fly him to the Bambino Gesu Hospital in Rome in the hope of prolonging his life.
The Italian hospital, which has links to the Vatican, suggested operations to help Alfie breathe and keep him alive for an "undefined period".
The judge said he would make a decision on what was best for Alfie if an agreement was not reached.
Who got to decide what happened to Alfie?
One of the dilemmas Alfie's case raised is whether doctors are the right people to determine if withdrawing life-support treatment is in "the best interests" of a terminally ill child.
One of the key arguments presented by his parents was that they should decide what is best for their son.
It was the same case made by the parents of Charlie Gard, the 11-month-old baby who died last year following a similar battle over his treatment.
The law in the UK falls somewhere in-between. The 1989 Children's Act makes it clear that where a child is at risk of harm the state can and should intervene.
This means that the rights of parents are not absolute and the state has been emboldened to challenge the view of parents where they believe a child's best interests are not being served.
If a public body disagrees with the parents' choices, they must go to court in order to override this parental responsibility.
What did the judges rule?
On 20 February, Mr Justice Hayden said doctors could stop providing life support for Alfie against his parents' wishes, saying the child required "peace, quiet and privacy".
Mr Evans said he believed his son was still responsive, telling reporters outside court Alfie was "improving".
But Michael Mylonas QC, representing the hospital, said: "One of the problems of this case is they [Alfie's parents] look at him and, barring the paraphernalia of breathing and feeding, he's a sweet, lovely, normal-looking boy who opens his eyes, [and] will smile..."
The hospital asserted that any movements by the child were "spontaneous seizures as a result of touching".
Mr Justice Hayden ruled in favour of hospital bosses and doctors were set to withdraw ventilation on 23 February before his parents embarked on a lengthy legal battle.
How the case unfolded
Alfie's parents refused to give up hope and took the case to the Court of Appeal on 6 March where judges upheld Mr Justice Hayden's decision.
On 20 March, the couple appealed to the Supreme Court where justices refused to give the couple permission to mount another appeal.
Despite this, their lawyers went to the European Court of Human Rights (ECHR) after exhausting all legal avenues in the UK.
But three judges ruled the submission "inadmissible", saying they were unable to find any violation of human rights.
On 11 April, Mr Justice Hayden then endorsed an end-of-life care plan for Alfie, setting a date to switch off life support. This was the first time Alfie's parents were represented by the Christian Legal Centre (CLC) in court.
The CLC is a sister body to Christian Concern and describes itself as an organisation that defends "individuals and churches who have suffered discrimination and challenges because of their desire to live and work according to biblical beliefs".
CLC lawyers began a final legal bid to the parents to take control over the treatment of their son on 16 April, claiming he was being "unlawfully detained".
Two days later Mr Evans flew to Rome for a meeting with the Pope, pleading with him to "save our son".
Despite an urgent application to the ECHR on Monday, judges refused to intervene in the case, prompting angry scenes at Alder Hey Children's Hospital.
Within hours, the Italian Ministry of Foreign Affairs granted 23-month-old Alfie Italian citizenship, hoping it would allow an "immediate transfer to Italy".
Pope Francis then tweeted his support for the family: "I renew my appeal that the suffering of his parents may be heard and that their desire to seek new forms of treatment may be granted."
But this last-ditch appeal was dismissed by Mr Justice Hayden who stated that "Alfie is a British citizen" who "falls therefore under the jurisdiction of the High Court".
The Italian Embassy has since clarified it was not trying to challenge any decisions made previously by the British courts.
A spokesman described the granting of citizenship as a "signal" to the judge that should he change his mind, they are ready to facilitate his transfer to the Italian hospital.
A further hearing then took place on Tuesday afternoon in which Mr Hayden said the case had now reached its "final chapter".
He rejected claims by Mr Evans's lawyers that his son was "significantly better" than first thought because he had been breathing unaided for 20 hours after doctors first withdrew life support.
Alfie's parents then launched a further appeal against the order stopping them from taking him to Italy, which was heard on Wednesday afternoon by a panel of three Court of Appeal judges, headed by Sir Andrew McFarlane.
The judges upheld a ruling preventing the 23-month-old from travelling abroad after life support was withdrawn.
What was Alfie's Army?
Throughout its campaign the family has been encouraged by Alfie's Army, a social media campaign whose supporters gathered regularly outside the hospital.
But after claims that the protesters were verbally abusing staff and making visits "scary", police launched an investigation into acts of intimidation.
Alfie's parents apologised, saying they did not intend to "harm or cause conflict or upset".
Before their son was granted Italian citizenship, a group of protesters tried to storm the front entrance before police officers formed a line to block the entrance.
A group of about 100 Alfie supporters held a candle-lit vigil outside the hospital overnight on Monday.
What happened after life support was withdrawn?
On Monday, Alfie's life support was turned off at 21:00 BST after a High Court judge dismissed fresh submissions heard in private from CLC lawyers.
Alfie's father had said his son was continuing to breathe unassisted and his life support should be reinstated.
On Tuesday morning, Ms James posted a picture on Facebook showing him sleeping in her arms.
"No matter what happens, he has already proved these doctors wrong. How amazing is he. How beautiful does he look," she wrote.
Asked on Wednesday if he had given up on taking their son to Italy, Mr Evans said: "No, we haven't. He's proving them wrong."
"It's time to give him some grace and dignity and let him go home or to Italy", he told ITV's This Morning.
Alder Hey Children's Hospital said it would not issue any updates on the toddler's condition "out of respect for the privacy of Alfie and his family".
Speaking outside the hospital on Thursday after a meeting with doctors, Mr Evans praised the staff for how they were treating Alfie.
He also thanked supporters Alfie's Army, but asked them to go home.