Mr. Trump, who was not known to have previously expressed a view on the matter, wrote on Twitter on Monday that if the United States could help, “we would be delighted to do so.”
Both the pope and the president stopped short of criticizing the court rulings or the hospital.
The infant was born on Aug. 6, 2016, with an extremely rare condition, encephalomyopathic mitochondrial DNA depletion syndrome. He is thought to be one of only 16 children globally to have it.
His parents, Connie Yates and Chris Gard, both in their 30s, have been waging a long and emotionally wrenching legal battle to keep him alive, and they have raised more than 1.3 million pounds, or about $1.7 million, to help finance experimental treatment in the United States.
Charlie has been treated at Great Ormond Street Hospital since October. The hospital said that it was acting in the child’s best interests. “When parents do not agree about a child’s future treatment, it is standard legal process to ask the courts to make a decision,” it said in a statement.
Three courts — the High Court on April 11, the Court of Appeal on May 25 and the Supreme Court on June 8 — sided with the hospital. The High Court ruled that Charlie faced significant harm if his suffering were to be prolonged without any realistic prospect of improvement. Moreover, it said the experimental therapy would not be effective. The British appellate courts agreed.
At that point, Charlie’s parents took the case to the European Court of Human Rights in Strasbourg, France, citing the European Convention on Human Rights, which protects the right to life, and arguing that the hospital was blocking access to life-sustaining treatment in the United States.
The European court ruled that the British courts had taken under consideration the views of Charlie’s parents and of medical experts, and had concluded that “it was most likely Charlie was being exposed to continued pain, suffering and distress, and that undergoing experimental treatment with no prospects of success would offer no benefit, and continue to cause him significant harm.”
The parents’ arduous legal journey appears to have come to an end, though an international campaign has been waged, with an online petition and even street protests in front of Buckingham Palace, pleading with the authorities to reconsider.
The hospital has not indicated when it would cut off life support.
“Our thoughts are with Charlie’s parents on receipt of this news, which we know will be very distressing for them,” it said, adding that the court’s decision “marks the end of what has been a very difficult process.” It added, “There will be no rush by Great Ormond Street Hospital to change Charlie’s care, and any future treatment plans will involve careful planning and discussion.”
In a detailed statement laying out the ethical and medical justification for not allowing Charlie to travel to the United States, the hospital said there was no cure for his condition, which was terminal. It said it had concluded that the experimental treatment in the United States would “not improve Charlie’s quality of life.”
“One of the factors that influenced this decision was that Charlie’s brain was shown to be extensively damaged at a cellular level,” it said. “The clinician in the U.S. who is offering the treatment agrees that the experimental treatment will not reverse the brain damage that has already occurred.”
Speaking to British journalists on Friday — before the pope and Mr. Trump weighed in — Ms. Yates said the family was making its final preparations and appeared to acknowledge that the case was coming to an end.
“We are really grateful for all the support from the public at this extremely difficult time,” she said. “We’re making precious memories that we can treasure forever with very heavy hearts. Please respect our privacy while we prepare to say the final goodbye to our son Charlie.”
It was not immediately clear on Monday if the parents’ views had changed in light of the comments from the pope and Mr. Trump.