MONTGOMERY, Ala. — A mother who lost custody of her terminally ill son to the state is fighting an effort to withhold life support measures and let the child die naturally.

The Alabama Court of Civil Appeals ruled in favor of the mother Tuesday and threw out a juvenile court order allowing a court-appointed guardian for the child, —identified in the opinion only as K.H. — to implement an end-of-life plan that would withhold resuscitation measures.

Because the case is in juvenile court, many of the details are unknown and it wasn't clear what the next step might be. Court officials would not provide contact information for a lawyer for the mother, identified as R.H., citing confidentiality laws.

Appellate judges wrote that the guardian ad litem — who is an attorney appointed to look out for the best interest of the child during the litigation — Emery D. Massey, did not have the authority to act as the child's representative in end-of-life decisions.

"The challenged order allows Massey to execute an (end of life) care order designed to withhold life-sustaining treatment from the child although Massey does not have any custodial power over the child. That error directly impacts the fundamental right of the child to life," the appellate court stated.

K.H. has Batten Disease, a degenerative neurological disease, and toxic epidermal necrolysis, a life-threatening skin disorder, the ruling said.

"According to the child's physicians, the child will, as his disease progresses, inevitably go into respiratory distress. The techniques that would be used to resuscitate the child, including chest compressions and placing the child on a ventilator, would themselves be painful and would only prolong the agony of the child," the decision said.

According to the court opinion, the Marshall County Department of Human Resources took temporary legal custody of K.H. in 2019 and filed to terminate the parental rights of the mother, but the reasons wasn't given. A judge in juvenile court, where proceedings aren't public, appointed Massey to represent the child's interests.

After Massey submitted a letter from the child's doctor detailing the child's terminal illness, treatment efforts and a recommendation that the child be allowed to die, a juvenile court last month granted Massey's request to move forward with a care plan allowing the child to die without life support.

The mother contended she saw the child about 10 days earlier and he had said "Mama," which she claimed showed signs of the child's improvement. However hospital social workers were prepared to testify the visit never occurred, the decision said.

Massey declined comment on specifics of the case but said his job requires "difficult decisions."

"It is a guardian ad litem's responsibility to look out for the best interests of the child they represent. In this case and in every case I handle I take this responsibility seriously and I will always fight to make sure that the best interest of a child are done," Massey wrote in an email.

Massey and the juvenile court were trying to act in the best interest of a child "in dire circumstances," the court said.