Terminally-ill Charlie Gard will be moved to a hospice and have his life support withdrawn soon after, a High Court judge has decided.
Great Ormond Street Hospital (GOSH) said it was not in his best interests to spend a long time in a hospice.
His parents had wanted a private team to care for Charlie so they could have more time with him. "GOSH have denied us our final wish," his mother said.
The judge approved a plan that will see Charlie die shortly after being moved.
Mr Justice Francis added that no details about when he would be moved and where could be made public.
In a statement, the hospital said it deeply regretted "that profound and heartfelt differences" between Charlie's doctors and parents have "had to be played out in court over such a protracted period".
Parents, Connie Yates and Chris Gard, and GOSH had until 12:00 BST to agree Charlie's end-of-life care. However, an agreement was not reached by the noon deadline.
The parents' lawyer, Grant Armstrong said they wanted to spend days with Charlie at a hospice before his death.
But hospital bosses said they could not agree to the arrangement as his parents had not found a paediatric intensive care specialist.
Commenting on the decision, Connie said: "We just want some peace with our son, no hospital, no lawyers, no courts, no media, just quality time with Charlie away from everything, to say goodbye to him in the most loving way.
"Most people won't ever have to go through what we have been through, we've had no control over our son's life and no control over our son's death.
"Despite us and our legal team working tirelessly to arrange this near impossible task, the judge has ordered against what we arranged and has agreed to what GOSH asked.
"This subsequently gives us very little time with our son."
The hospital said there was "simply no way that Charlie... can spend any significant time outside of an intensive care environment safely".
It added: "We will arrange for Charlie to be transferred to a specialist children's hospice... who will do all they can to make these last moments as comfortable and peaceful for Charlie and his loved ones."
GOSH said that "while we always respect parents' views, we will never do anything that could cause our patients unnecessary and prolonged suffering".
The High Court order says Charlie will continue to be treated in hospital for a "period of time" before being moved to the hospice, which cannot be named for legal reasons.
It says doctors can then withdraw "artificial ventilation" after a period of time.
Everyone involved has agreed that the "arrangements" will "inevitably result in Charlie's death within a short period thereafter", the order adds.
Timeline of Charlie's case
- 3 March 2017: Mr Justice Francis starts to analyse the case at a hearing in the family division of the High Court in London
- 11 April: He says doctors can stop providing life-support treatment
- 3 May: Charlie's parents ask Court of Appeal judges to consider the case
- 23 May: Three Court of Appeal judges analyse the case
- 25 May: The Court of Appeal judges dismiss the couple's appeal
- 8 June: Charlie's parents lose their fight in the Supreme Court
- 20 June: Judges in the European Court of Human Rights start to analyse the case, after lawyers representing Charlie's parents make written submissions
- 27 June: Judges in the European Court of Human Rights refuse to intervene
- 3 July: The Pope and US President Donald Trump offer to intervene
- 4 July: The Vatican's children's hospital in Rome, offers to take in Charlie
- 7 July: Great Ormond Street Hospital applies for a fresh hearing at the High Court
- 10 July: Charlie's parents return to the High Court and ask Mr Justice Francis to carry out a fresh analysis of the case. Mr Justice Francis says he will consider any new evidence.
- 17 July - Dr Michio Hirano, the US neurologist, travels to London to examine Charlie
- 21 July - Lawyer representing Great Ormond Street says Charlie's new scan makes for "sad reading"
- 22 July - Great Ormond Street says doctors and nurses have been subjected to abuse and received threatening messages
- 24 July - Charlie's parents say they will end their legal fight for his treatment and let him die
- 26 July - Deadline set for Charlie's parents and Great Ormond Street Hospital to agree how and when he will die
- 27 July - Mr Justice Francis rules Charlie will be moved to a hospice and have his life support withdrawn "soon after" after an agreement to decide his end-of-life care was not reached.