London, England (CNN) -- The father of a baby with a severe birth defect has agreed to let the child die, ending a British court battle against the baby's mother, the judge in the case announced Tuesday.
The baby's father had been fighting the mother and the hospital in London's High Court.
The child -- identified only as Baby RB -- is 13 months old and suffers from congenital myasthenic syndrome, a rare genetic condition which means he cannot breathe on his own.
"Unless the (ventilator) delivers air every three seconds, his body will go into crisis and decline. Recent attempts to lengthen this period by just one second have had to be abandoned, such is his need for artificial ventilation from the machine upon which he is, and will always be, totally dependent," Judge Andrew McFarlane said in concluding remarks on Tuesday.
"RB has been trialled on each of the three known drugs. Tragically he has not shown any effective response," the judge said.
The baby's brain is not affected by his condition, experts testified.
"The medical evidence is to the effect that he is likely to feel pain and discomfort in the same manner that any baby does, yet this little boy with his inscrutable features, immobile limbs and soundless voice often gives no outward sign of that which he is feeling," McFarlane said.
His lungs fill with fluid every few hours -- giving him the sensation he is choking -- and that doctors must then use suction to remove the fluid, also causing the child to suffer, lawyers representing the hospital said in court when the case opened November 2.
Ultimately the father agreed with the mother and the hospital that the best thing for the baby was for "his time (in intensive care) to end in a planned way, with the administration of a large dose of sedative, the removal of the ventilation tube and his consequent death," the judge said.
The parents will now decide in consultation with the doctors when to do that, Kiran Bhogal, a lawyer for the hospital, told CNN.
The father originally took the case to court to stop them from taking the infant off his ventilator.
He said the baby can play and recognize its parents.
The baby's parents are amicably separated, the father's lawyer said. They are both in their 20s, the judge said.
No one involved in the case can be named due to a court order protecting their privacy.
But the judge went out of his way to praise both parents on Tuesday.
"RB's key nurse said of the parents: 'They are brilliant; they are great parents; they love him dearly, are always at his bedside and always want what they feel is best for him,'" McFarlane said.
They "have spent the most part of each and every day of the last 13 months at RB's bedside, doing what they can to care for him and, when the opportunity arises, to interest and stimulate him, seizing upon any sign of a spark and trying to develop it into something more," he said.
"These two young people have stepped up to the plate and discharged the responsibility that life had thrust upon them by each showing 100 percent commitment to their child in a manner which can only command profound respect and admiration," McFarlane said.
The baby's birth defect "causes severe muscle weakness, feeding and respiratory problems, and the disease is progressive," the hospital said in a statement.
The hospital, which is part of Britain's National Health Service, said it is doing what is best for the child.
"Baby RB's case is a deeply tragic one," the hospital said in a statement when the court case opened. "We understand how difficult this legal process must be for both parents and RB's extended family and friends. However, all those involved in the care of RB are taking these steps because they consider it is in RB's best interests."
The baby has been taken off its artificial respirator at least three times, lawyers for the hospital said.
The first time he was able to breathe unaided for 40 minutes. The second time he lasted 30 minutes, and the third time only five minutes before he had to be reconnected to the ventilator, they said.
There are different types of CMS.
"Despite testing it remains unclear which form of CMS (Baby RB) suffers from," Bhogal, the lawyer representing the hospital, told CNN.
CNN's Morgan Neill in London contributed to this report.