Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

LONDON — A British judge gave the parents of Charlie Gard until noon on Thursday to agree on arrangements for his death with the hospital caring for him, failing which he would be transferred to a hospice where his ventilation tube would be removed.

Baby Charlie Gard with his parents, Connie Yates and Chris Gard. Go Fund Me

The 11-month-old baby, who suffers from an extremely rare genetic condition causing progressive brain damage and muscle weakness, has been the subject of a bitter dispute between his parents and Great Ormond Street Hospital in London.

The case has triggered a heated international debate in the press and on social media about who should decide a child's fate, and has drawn comment from U.S. President Donald Trump and Pope Francis.

Having reluctantly taken the decision over the weekend to let Charlie die, his parents have been making desperate attempts to make an arrangement that would make it possible for them to spend several days with him, away from hospital.

Charlie requires invasive ventilation to breathe and cannot see, hear or swallow.

At stake in this final, agonizing part of the legal dispute is how long Connie Yates and Chris Gard will have with their son before he dies.

Related: Charlie Gard’s Parents Want to Take Boy Home to Die

The parents tried for several days to gain permission to take their son home, but as Wednesday's court hearing progressed it became clear that would not happen because the logistical problems were insurmountable.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Baby Charlie Gard with his parents, Connie Yates and Chris Gard. Go Fund Me

The parents had made clear that if they could not take Charlie home, they would prefer him to die in a hospice rather than in the hospital, where he has spent most of his life.

But a lawyer for Charlie's court-appointed guardian told the court that no hospice could provide care for intensively ventilated children for a long time, so the parents' wish to spend several days with him could not be fulfilled.

The parents have been trying to find a doctor willing to oversee a plan that would allow Charlie to be ventilated in a hospice for several days. It was to give them a final chance of making such an arrangement that the judge gave them until noon on Thursday.

"Unless by 12 noon tomorrow the parents and the guardian and the hospital can agree an alternative arrangement, Charlie will be transferred to a hospice and extubated shortly after," said Nicholas Francis, the judge presiding over the case.

In response to the ruling, Charlie's parents posted an urgent plea on their Facebook page Wednesday afternoon seeking a medical professional willing to facilitate a hospice stay for the baby at their home.

MOTHER IN TEARS

An alternative arrangement appears unlikely, given the total breakdown in relations between the parents and the hospital.

The judge ordered that the name of the hospice and the exact timing of Charlie's last moments should not be disclosed to the public.

Connie Yates, mother of Charlie Gard, and her lawyer arrive at the Royal Court of Justice in London on July 26, 2017. A British judge is set to rule on where Charlie Gard, a baby with a rare genetic disease, will spend the last days of his life. A High Court judge will decide whether his parents' wish to take him home to die will be granted. Kirsty Wigglesworth / AP

At one point, Yates shouted in court, apparently at Charlie's guardian: "What if it was your child? I hope you are happy with yourself." She then left the courtroom in tears.

At the start of the hearing, the parents' lawyer Grant Armstrong had said they had found a doctor who could help them.

But the guardian's lawyer, Victoria Butler-Cole, later said the person in question was a general medical doctor with no experience of intensive care, and that he had not identified any hospice willing to undertake intensive care for a long period.

Butler-Cole said the parents should spend the last few days of Charlie's life with him, not with their lawyers.

The dispute first made headlines months ago, when Charlie's parents wanted to take him to the United States to undergo experimental treatment.

Related: Trump Tweets Support for Terminally Sick Baby Charlie Gard

The Great Ormond Street doctors said it would not help and would only prolong the baby's suffering. British courts, backed by the European Court of Human Rights, refused permission, saying the parents' plan was not in Charlie's best interests.

The parents gave up the legal battle on Monday, saying that the latest scans showed Charlie's condition had deteriorated to the point that no recovery was possible. But they remain convinced that the treatment might have helped Charlie had he received it months ago.

The hospital disagrees. It says Charlie had suffered irreversible brain damage by January as a result of a series of seizures, and his responsiveness has not changed since then.