Charlie Gard will most likely end his life in a hospice, after the terminally ill baby's parents were frustrated in their attempt to bring him home to die.
The case that captured worldwide attention returned to court again on Wednesday after Great Ormond Street Hospital (GOSH) and Charlie's parents could not to agree on a plan for the rest of Charlie's life.
On Monday the High Court decided there was no treatment option left for the child.
On Wednesday Mr Justice Francis said that if the parents and the hospital didn't agree an alternate care plan by noon Thursday, Charlie would be transported to a hospice – where he would live for just a few hours.
He said it was three and a half months since his original decision that Charlie be allowed to die with dignity. At that time he had found that Charlie might be in pain.
Charlies's mother Connie Yates was not in court to hear the decision, having broken down and left shouting "what if it was your child", media in the courtroom reported.
Charlie's parents had asked for more time to find a way for their terminally ill child to die outside of GOSH where he remains on life support.
They had wanted him at home with them on a ventilator for several days before palliative care began and their child was allowed to die.
However the hospital said Charlie's 'invasive ventilation' required constant monitoring by a trained nurse, with a doctor on call and close at hand.
A suitable ventilator would not fit through the parents' front door, the hospital said.
"His care cannot be simplified, it must be provided in a specialist setting by specialists," it said.
The hospital said it had found an "excellent hospice" with the space and privacy, and the facilities needed.
"It would offer the opportunity to create memories and perhaps to begin a time of healing," the hospital said.
However hospices lacked the resources and staff to provide ventilation for more than "a period of hours", the hospital said. Hospital staff would remain with Charlie until it was time to take him off life support.
Charlie's mother Connie Yates came to court on Wednesday, while Chris Gard stayed by his son's side in hospital.
The parents' lawyer conceded that the home option was not possible, but asked for more time to try to find an alternative.
Charlie's parents had asked a family GP to supervise Charlie's care outside hospital, but after two hours discussion at the court it was decided he did not have the necessary skills or experience.
Mr Justice Francis said he had been hoping for consensus.
"This indecision is compounding the parents' misery," he said.
He said he had gone out of his way to accommodate the parent's wishes, but he had to consider Charlie's best interests.
The exact time and place of Charlie's death were to be kept private.
The care plan for Charlie must honour his parents wishes about the time and place of his passing, but also be safe, spare Charlie all pain and protect his dignity, the hospital said in a statement issued on Tuesday.
The hospital said the parents had refused the offer of a mediator, and palliative care consultants had had a "lengthy, difficult and sadly but understandably in the dreadful circumstances unconstructive meeting with the parents".
Mr Justice Francis also spoke out against "misinformed comment on social media", saying it was not true that he was deciding the case because of the UK's system of socialised medicine