Although the judges refused to issue a blanket declaration covering similar situations, Lord Woolf, the Master of the Rolls, said medical staff should fully consult with parents or legal guardians on the treatment of children. In situations of "grave conflict" the case should go to the Family Division of the court to decide on the course of action, he said.
"I knew that this wasn't going to be clear cut," said Carol Glass, 38, who brought the case after doctors left her son, David, to die naturally. "But I am pleased with parts of what the judges said. I got what I wanted.
"I am pleased about the part of the judgment when the judges made it clear that doctors have got to at least listen to the parents and if it can't be resolved between parents and the medical staff then go to court," she said.
David, who was born with water on the brain and is blind with spastic quadriplegia, was admitted to St Mary's Hospital, Portsmouth, with pneumonia last October. Doctors decided there was nothing they could do to save him and wanted to let nature take its course. They withdrew treatment and administered diamorphine, a heroin-based painkiller that can hasten death, so he could "die with dignity".
Mrs Glass removed the diamorphine from his arm and 15 members of her family managed to resuscitate him by blowing raspberries in his ear and rubbing his legs. The disturbance caused by the family is the subject of a separate criminal proceeding.
David returned home and has made a good recovery, playing with his sisters and enjoying days out with the family, Mrs Glass said.
She went to the courts because she was concerned over what would happen if he fell seriously ill again. She claimed that the doctors acted illegally and beyond their powers when they decided, against her wishes and without going to court, to allow her son to die.
However, Lord Woolf, sitting with Lady Justice Butler-Sloss and Lord Justice Robert Walker, rejected her appeal and said it would be "an inappropriate task" for the court to intervene in the current circumstances or in anticipation of future problems. If they did arise, Mrs Glass could return to court, he said.
"Considerations which can arise in relation to David, and other children who have got disabilities of the sort he unfortunately suffers from, are almost infinite," he said.
"It can be said - there cannot be any doubt about this - that the best course is for the parent of a child to agree on the course which the doctors are proposing to take, having fully consulted the parent, and for the parent to be fully understanding of what is involved.... That is the course which should always be sought to be adopted in a case of this nature."
But if that was not possible and the conflict was of a grave nature - "then what one must do in that situation is bring the matter before the court so that the court can do what is in the best interests of the child concerned".
David Congdon, the director of public affairs for Mencap, the mental health charity, said: "We are very disappointed with this ruling. This case highlights the problem that exists surrounding health care for people who do not have the mental capacity to make decisions for themselves.
"It is wrong that doctors have the power to effectively deny treatment to children or adults with severe disabilities against the wishes of the parents," he said.
But Dr Michael Wilks, chairman of the British Medical Association's medical ethics committee, said: "We agree with the court that each case must be considered individually and that it would not be right to make blanket declarations about how complex clinical cases must be handled."