LONDON — Charlie Gard, the incurably ill British infant who died on Friday, could not hear, see or even cry. But his case captured the attention of the pope and the United States president, and raised difficult ethical issues that reverberated around the world.

He died with his parents by his side a day after a court ruled that he could be moved to a hospice and that his life support could be withdrawn. His death was confirmed by a family spokesman.

In an emotional statement before the court this past week, Charlie’s mother, Connie Yates, noted that her son had “had a greater impact on and touched more people in this world in his 11 months than many people do in a lifetime.”

On Thursday, the British High Court said the infant, who had a rare and debilitating genetic condition known as mitochondrial DNA depletion syndrome, could be moved to a hospice, where his life support was removed. Charlie, who would have turned a year old on Aug. 4, was not able to peer at his parents’ faces because he could not see. He also could not hear or swallow.

The child’s final moments were not as his parents had hoped. They fought a long and often tense battle in court to control his fate, to take him to the United States for experimental treatment and, finally, to move him to their home in West London to die.

‘Our final wish’

They lost their fight. On Thursday, Ms. Yates, who works as a caregiver, said in statement that the hospital had “denied us our final wish.”

“Most people won’t ever have to go through what we have been through,” she said. “We’ve had no control over our son’s life and no control over our son’s death.”

But the doctors treating Charlie at Great Ormond Street Hospital in central London countered that the “risk of an unplanned and chaotic end to Charlie’s life” at home was “unthinkable.” For months, the hospital had argued that he had irreversible brain damage, that the life support should be removed and that he should be allowed the right to die with dignity.

“We deeply regret that profound and heartfelt differences between Charlie’s doctors and his parents have played out in court over such a protracted period,” the hospital said in a statement. “We will never do anything that could cause our patients unnecessary and prolonged suffering.”

Questions of ethics

The case laid bare several issues, among them: Should parents or doctors or the courts have the final say in irreconcilable disputes over the treatment of sick children?

And at what point should the limits of medicine be recognized and the parents of an incurable infant be compelled to let go?

Biomedical ethicists said the case offered a cautionary tale of how a legal battle, scrutiny by the global news media and intractable differences between parents and doctors can spiral out of control in the social media age. Both the hospital and the parents in the Gard case dug in, their arguments playing out on Facebook and Twitter and capturing the attention of world figures including President Trump and Pope Francis.

The pope posted a message on his personal Twitter account shortly after news broke of the infant’s death. “I entrust little Charlie to the Father and pray for his parents and all those who loved him,” the tweet said.

Dr. Robert D. Truog, a physician at the pediatric intensive-care unit at Boston Children’s Hospital and the director of the Center for Bioethics at Harvard Medical School, said that “Charlie’s parents were like parents all over the world — they were willing to do absolutely anything to save the life of their child.”

He added: “They were the victims, not the cause, of this tragic situation.”

The parents’ raw emotions played out in the courtroom, where Ms. Yates broke down in tears of frustration, at one point shouting, “What if it was your child?” before fleeing the room. At another moment, Mr. Gard, a mailroom worker, cried out, “Evil” after a hospital lawyer spoke.

On several occasions, both parents stormed out of the courtroom. Some of the lawyers and journalists covering the case were reduced to tears.

The case went through several courts, including Britain’s Supreme Court and the European Court of Human Rights in Strasbourg, France, which backed the hospital’s views — in part because experts said Charlie could be suffering.

His parents insisted he was not.

Protests and death threats

Some American conservatives seized on the case as a warning of the pitfalls of socialized medicine and the abrogation of parental rights, even as the High Court judge presiding over the case, Nicholas Francis, countered that to make a scapegoat out of Britain’s National Health Service was “nonsensical.”

In most cases, medical experts say, doctors decide when to remove life support from an incurably ill child, in consultation with parents, and these cases rarely wind up in court. But in Britain, the courts are the final arbiter when irreconcilable disputes arise.

Charlie also became a powerful symbol for anti-abortion groups the world over. Protesters picketed outside Great Ormond Street Hospital, and Judge Francis denounced death threats against hospital staff members.

The case also spurred questions about the wisdom of offering parents the hope of experimental treatment when faced with an incurable disease. That debate took center stage after Dr. Michio Hirano, a neurologist at Columbia University Medical Center in New York, offered Charlie’s parents a ray of hope that an experimental treatment known as nucleoside therapy could improve Charlie’s condition.

The treatment had been tested on mice and on 18 people with a mutation in a gene known as TK2. But it had never been tried on someone with Charlie’s particularly debilitating form of mitochondrial DNA depletion syndrome, which is caused by a different genetic mutation.

During an often-acrimonious and emotional High Court hearing this month, Charlie’s parents argued that he should be allowed to receive the experimental treatment. But lawyers for Great Ormond Street Hospital countered that Dr. Hirano had held out hope without even examining the child or reviewing his full medical charts.

(Dr. Hirano said in a statement he had been contacted by the parents and agreed to speak with Charlie’s doctors to determine whether the experimental therapy he was developing could help improve the child’s condition).

When Dr. Hirano traveled to London this month to examine Charlie, about six months after he had first been invited, a series of scans showed that the boy had suffered muscular atrophy, that the damage was irreversible and that treatment would be futile.

Ms. Yates criticized the hospital, saying it had dragged its feet about the treatment until it was too late.

The hospital consistently stood by its contention that treatment would have been useless and that Charlie had irreversible brain damage.

“If Charlie has had a relationship with the world around him since his best interests were determined, it has been one of suffering,” it said in a statement.

‘Enough is enough’

Dominic Wilkinson, a neonatologist and professor of medical ethics at Oxford University, said the case offered a tragic lesson about the risks of doctors’ offering uncertain hope to desperate parents. At the same time, he said, the case underscored the importance of mediation during a dispute about treatment, noting that the communication breakdown in the Gard case had all the attributes of a “messy divorce.”

“To let a child go is incredibly difficult, but it is also incredibly important,” he said. “It is heartbreaking, but we have to know when to say enough is enough.”

Dr. Truog of Harvard Medical School said the parents’ legal battle had tapped into the health care debate in the United States, and was being seized upon by some to affirm a money-driven system in which patients who have the means can pursue experimental treatments, even if the chances of success are slim. But he said experimental treatments must be weighed against the benefits for society as a whole.

In the United States, “no one can demand nonbeneficial treatments simply by claiming they are paying out of pocket,” he wrote in a recent article on the Gard case in The Journal of the American Medical Association.

“It would be extremely rare for a hospital in the United States to admit patients for the exclusive purpose of receiving homeopathic therapy or unproven stem cell infusions,” he wrote, “regardless of how much the patient paid.”

The parents now face coming to terms with Charlie’s death. Addressing the court this past week, Ms. Yates acknowledged that this would not be easy.

“We are struggling to find any comfort or peace with all this,” she said. “But one thing that does give us the slightest bit of comfort is that we truly believe that Charlie may have been too special for this cruel world.”