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.