But the little girl will live at least a few days longer after Justice June Ross's ruling was stayed by a higher court within hours of being issued until an appeal can be heard.
"It is a difficult situation," said Appeal Court Judge Jean Cote after his ruling late Friday afternoon. "There are some drawbacks to any possible decision here."
The case came to court after paramedics found the girl and her twin sister in an Edmonton home on May 25. Both were malnourished and suffering from injuries. The girl in question was in cardiac arrest. The other twin is recovering. A brother was in home as well, but he was OK and is now in foster care.
Their parents have been charged with aggravated assault, criminal negligence causing bodily harm and failing to provide the necessities of life. They have been denied bail and are in the Edmonton Remand Centre.
Their names cannot be released to protect the identities of the children.
Medical experts testified the girl had suffered "profound and irreversible brain injury."
She can't move on her own and requires the support of a machine to breathe. She has no upper brain function and is not expected to ever recover.
"(She) does not meet the criteria for brain death, but she is close to it," wrote Ross.
Experts testified she has suffered repeated illness and urgently needs an operation to allow her to keep using the breathing machine. That operation is likely to be only the first in a series of invasive procedures, each of which carries the risk of bleeding and infection. Doctors are unsure if the girl is able to feel pain.
Although Alberta Family and Child Services has custody of the girl, guardianship remains with the parents. They oppose the recommendations of their daughter's medical team that her life support be removed.
In an affidavit, the father wrote: "My religious belief is that if it is Allah's will that despite all the doctors can do for (her) that she passes from this life, then it is God's will. As a devout Muslim and loving father I find it unthinkable to agree to limit or withdraw medical treatment."
But Ross ruled that it was the child's best interests that should come first.
"There are further medical challenges and further invasive treatments aimed only at continuing a life that holds no benefits for her."
As well, Ross cast doubt on the parents' motives for wanting to keep the girl alive. The criminal charges against them could be elevated to murder if she dies.
"They are, inherently, in a conflict of interest," she wrote in her decision Friday.
"I am left with a concern that their decision may, in fact, be affected by self-interest."
Still, lawyer April Kellet argued in front of the hastily convened Appeal Court hearing that the issues at hand were too important not to be tested. She said the parents have lost the right to make decisions on behalf of their child, despite the fact they remain her legal guardian and that the charges against them haven't been proved.
"When we apprehend a child and we charge the parents, do they then lose the ability to make medical decisions on behalf of their children because of a situation they're put in?" she asked.
Lawyer JoAnn Quinn, who spoke on behalf of the girl, said it is her best interests that should prevail.
"(Her) emaciated, paralyzed, lifeless body must speak for her."
The appeal of Ross's decision could be held as early as Wednesday.
Also on HuffPost