The Supreme Court has rejected an appeal by the parents of sick baby Charlie Gard, over plans to take him to the US for treatment.
Chris Gard and Connie Yates want the 10-month old, who suffers from a rare genetic condition, to undergo a therapy trial.
His mother broke down and screamed as the decision was announced.
Charlie can stay on life support for 24 hours to give the European Court of Human Rights a chance to give a ruling.
He has been in intensive care at Great Ormond Street Hospital since October last year.
The hospital said therapy proposed by a doctor in America is experimental and that Charlie’s life support treatment should stop.
Charlie has mitochondrial depletion syndrome, a rare disorder that affects the genetic building blocks that give energy to cells.
‘Very sad day’
The family division of the High Court agreed two months ago that the hospital could withdraw Charlie’s life support.
His parents have raised more than £1.3m through an internet appeal, in the hope they could take him to America for an experimental treatment.
A spokesperson for Great Ormond Street Hospital said it was a “very sad day” for Charlie’s parents and family.
“It is never easy when medical and judicial opinion goes against the wishes of the parents but our first responsibility at Great Ormond Street Hospital remains to put the interests of the child first and foremost.
“It is also hugely difficult for any clinically-trained professional to be asked to treat a child who has no chance of survival or even improvement in his quality of life”, the hospital added.
“For now, our priority is to ensure Charlie remains well cared for and to offer our support to Charlie’s devoted parents at this distressing time.”
BBC News correspondent Helena Lee, at the Supreme Court
Charlie’s supporters gathered outside the court ahead of the hearing.
Holding pictures of the 10-month-old they chanted ‘Save Charlie Gard’ and “give him a chance”.
Inside his parents waited for the decision. This is the final court in the UK able to hear their case.
Justice Lady Hale began by praising their devotion, as parents we would all want to do the same she said.
But as judges and not as parents they were concerned with the legal position and the proposed appeal she said was refused.
Charlie’s mother Connie left the court wailing and shouting “they’ve put us through hell”.
Chris, Charlie’s father, held his head in hands and cried.
This may though not be the end. They want to try and take their case to the European Court of Human Rights.
Katie Gollop QC, leading Great Ormond Street’s legal team, said the case was “sad” but not “exceptional”.
She said the couple seemed to be suggesting that “parents always know best”.
“Fundamentally the parents don’t accept the facts,” she said. “They don’t accept that nucleoside therapy will be futile.”
The court had earlier heard how Charlie could not could see, hear, move, cry or swallow.
Ms Gollop added: “He is on a machine which causes his lungs to move up and down because his lungs cannot go up and down.
“Charlie’s condition affords him no benefit.”
Following the ruling Ms Yates screamed outside court: “How can they do this to us?”
“They are lying. Why don’t they tell the truth?”, she said.
Charlie’s life support machine will continue until Friday at 17:00 BST to give judges in Strasbourg, France, time to look at the case, the court said.