The hospital in London, England that has been caring for him recently asked a judge to allow doctors to remove Charlie's life support without his parents' permission, the Daily Mail reported in March.
Justice Nicholas Francis ruled with the "heaviest of hearts" but "complete conviction" that life support treatment in London for eight-month-old Charlie Gard should be ended.
Baby Charlie was born on August 4 and suffers with a disorder called mitochondrial depletion syndrome which causes progressive muscle weakness.
The doctor behind the experimental nucleoside therapy in America accepted that it was "very unlikely" that Charlie's condition would improve with the treatment.
The judge's ruling was met with a scream of "no!" and Charlie's parents, Connie Yates and Chris Gard, wept as the decision was announced.
Charlie's parents were devastated by the court decision and struggled to understand why the judge had not "at least given Charlie the chance of treatment", their solicitor, Laura Hobey-Hamsher, said.
"What parents would not do the same?"
During the hearing, one expert, who can not be identified, told Mr Justice Francis via telephone link from the U.S. that Charlie was "in the terminal stages of illness" and admitted he did not previously realise how severely ill he was.
The couple, from West London, said the youngster should be sent to the USA for experimental treatment that could extend his life.
"I want to thank the team of experts and carers at Great Ormond Street, and others who can not be named, for the extraordinary care that they have provided to this family".
Charlie's parents raised more than £1.2mn over two months through an appeal on a GoFundMe website for the United States treatment after more than 80,000 people pledged money.
They reached their target on Sunday and more than 80,000 people have donated money.
'We just want to have our chance'.
In making the ruling, he paid tribute to both the doctors who treated Charlie and his parents' "brave and dignified" campaign to save their son. "Even if Charlie doesn't make it through this, I don't ever want another mum and their child to go through this".
'It is too simplistic to say that had matters been handled better, Charlie would be well, but undoubtedly, it did not assist'.
A GoFundMe spokesman said officials will hold discussions with Charlie's parents about what would happen to money raised for treatment.
"We've never been so stressed in our lives but we'd do it all again in a heartbeat because you are worth every ounce of pain and every single tear!"