The parents of terminally ill baby Charlie Gard have ended their legal challenge to take him to the US for experimental treatment.
A lawyer representing Chris Gard and Connie Yates told the High Court "time had run out" for the baby.
Mr Gard said it meant his "sweet, gorgeous, innocent little boy" will not reach his first birthday on 4 August.
"To let our beautiful little Charlie go" is "the hardest thing we'll ever have to do", his mother said.
Charlie's parents said they made the decision because a US doctor had told them it was now too late to give Charlie nucleoside therapy.
"We only wanted to give him a chance of life," Ms Yates told the court in a statement.
"A whole lot of time has been wasted," she added.
"We are sorry we could not save you."
Their lawyer Grant Armstrong said the parents' worst fears had been confirmed.
He told judge Mr Justice Francis US neurologist Dr Michio Hirano had said he was no longer willing to offer the baby experimental therapy after he saw the results of a new MRI scan last week.
He added Mr Gard and Ms Yates, from Bedfont, west London, now hoped to establish a foundation to ensure Charlie's voice "continues to be heard".
In a statement outside court, Mr Gard said Charlie was an "absolute warrior" and they "could not be prouder of him."
"Charlie has had a greater impact on and touched more people in this world in his 11 months than many people do in a lifetime.
"We could not have more love and pride for our beautiful boy.
"We are now going to spend our last precious moments with our son Charlie, who unfortunately won't make his first birthday in just under two weeks' time."
They had raised £1.3m in donations to take their son abroad for treatment.
Charlie has encephalomyopathic mitochondrial DNA depletion syndrome. He has brain damage and cannot move his arms or legs.
Katie Gollop, the lawyer representing Great Ormond Street Hospital (GOSH) where Charlie has been treated since October, said doctors disagreed with the parents who believed MRI scans in January had shown "treatment could have been effective at that time".
"All aspects of the clinical picture and all of Charlie's observations indicated that his brain was irreversibly damaged and that [the therapy] was futile," she said.
The hospital paid tribute to the "bravery" of the decision made by Charlie's parents.
In a statement, it said: "Over the weekend, they communicated their desire to spend all the time they can with Charlie whilst working with the hospital to formulate the best possible plan for his end of life care.
"The agony, desolation and bravery of their decision command GOSH's utmost respect and humble all who work there."
Mr Justice Francis paid tribute to Charlie's parents and said no-one could comprehend their agony and no parents could have done more.
In his judgement, the judge said last week's MRI scans had shown "Charlie has no muscle at all" on parts of his body and was "beyond help".
He said Mr Gard and Ms Yates were now prepared to accept Charlie should be moved to palliative care and be allowed to die with dignity.
The judge also decried the "absurd notion which has appeared in recent days that Charlie has been a prisoner of the National Health Service", calling it "the antithesis of the truth".
"In this country children have rights independent of their parents," he said.
Occasionally there were circumstances when a hospital and the parents were unable to agree what course of action was in the best interest of the child patient, in that instance the decision is referred to an independent judge, he continued.
Outside court, Charlie's Army campaigners reacted angrily and chanted, "shame on you judge" and "shame on GOSH".
Falling to the ground, one female supporter said: "He had a chance and you took it away."
Charlie Gard: Timeline of parents' legal battle
- 3 March 2017: Mr Justice Francis starts to analyse the case at a hearing in the Family Division of the High Court in London.
- 11 April: Mr Justice Francis says doctors can stop providing life-support treatment.
- 3 May: Charlie's parents ask Court of Appeal judges to consider the case.
- 23 May: Three Court of Appeal judges analyse the case.
- 25 May: Court of Appeal judges dismiss the couple's appeal.
- 8 June: Charlie's parents lose fight in the Supreme Court.
- 20 June: Judges in the European Court of Human Rights start to analyse the case after lawyers representing Charlie's parents make written submissions.
- 27 June: Judges in the European Court of Human Rights refuse to intervene.
- 3 July: The Pope and US President Donald Trump offer to intervene.
- 7 July: Great Ormond Street Hospital applies for a fresh hearing at the High Court.
- 24 July: Charlie's parents end their legal fight to take him to the US for treatment.