The parents of terminally-ill Charlie Gard have agreed he should spend his final days in a hospice.
Connie Yates and Chris Gard originally asked to be allowed to take their son home to die, after ending their legal case on Monday to seek therapy abroad.
For practical reasons, Great Ormond Street Hospital (GOSH) said a hospice was the most appropriate place for him.
His parents and the hospital have until 12:00 BST on Thursday to agree his end of life care and how long he has left.
The court heard there was a dispute between hospital bosses and Charlie's parents about care plans for the 11-month old baby.
Ms Yates and Mr Gard have now accepted their son has to be moved to a hospice but wanted to spend a week there with him before he died.
Some nurses from GOSH and a doctor have volunteered to care for the terminally-ill baby during that time, the family's lawyer Grant Armstrong said.
The family had been unable to find an intensive care specialist, which the hospital had said was "essential" for Charlie's care, though.
Setting the deadline, Mr Justice Francis said he hoped all parties could reach an agreement by 12:00 BST on Thursday, otherwise Charlie would be moved anyway and his life support treatment ended soon after that.
He said the name of the hospice and when Charlie was admitted would remain private.
As the judge made his decision, Ms Yates shouted "I hope you are happy with yourselves" and left the court crying.
On Monday his parents ended their legal fight to take Charlie to the US for experimental therapy on the advice of the US doctor who had offered the treatment.
Mr Gard said his "beautiful" son was not expected to live to see his first birthday on 4 August.
Charlie has encephalomyopathic mitochondrial DNA depletion syndrome. He has brain damage and cannot move his arms or legs.
Charlie Gard: Timeline of parents' legal battle
- 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: Mr Justice Francis 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: Court of Appeal judges dismiss the couple's appeal.
- 8 June: Charlie's parents lose 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.
- 7 July: Great Ormond Street Hospital applies for a fresh hearing at the High Court.
- 24 July: Charlie's parents end their legal fight to take him to the US for treatment.