LONDON — Pope Francis offered prayers after his traditional Sunday blessing in St. Peter's Square for Alfie Evans, a terminally ill British toddler whose parents are locked with hospital officials in a legal battle over his care.

The pontiff said such situations are "very painful and complex" as he prayed for Alfie and others who are suffering serious infirmities. He expressed hope that they "are always respected in their dignity and cared for in a way suitable to their conditions, with the agreement of family members, doctors and health workers."

Monsignor Vincenzo Paglia, head of the Pontifical Academy of Life, a Vatican bioethics think tank, said earlier Sunday that Alfie's parents and hospital officials should work together so his life isn't "reduced to a legal dispute."

Francis' comments mark the second time in less than a year that he has intervened in the case of a terminally ill British child. Last July, he spoke out on behalf of Charlie Gard, who died of a rare genetic disease after a vicious court battle in which his parents sought treatment first in the United States and then Italy.

Alfie's parents are preparing for a hearing Monday at Britain's Court of Appeal during which they will try to overturn earlier rulings that have blocked further treatment. The High Court, Court of Appeal, Supreme Court and European Court of Human Rights have previously backed doctors, who say Alfie's condition is irreversible.

Alfie, now 23 months old, is in a "semi-vegetative state" at Alder Hey Children's Hospital in Liverpool as the result of a degenerative neurological condition that doctors have been unable to definitively identify.

Protesters gathered outside the hospital last week after a judge endorsed a plan for doctors at Alder Hey to withdraw life support.

Speaking outside the hospital on Friday, Alfie's father, Tom Evans, 21, said he had chartered a jet to take the child to Italy but had been stopped by the hospital.

"If he stays here and dies, he dies," Evans said. "If he goes and he dies at least he has died a hero, trying."

The hospital said that it would not help Alfie to subject him to further tests.

"Alfie's clinical condition is truly heart-rending, but at each stage of the legal process, which has to be followed in such cases, the courts have agreed with the treating team and the independent expert advisers instructed by the trust and the family that Alfie's condition is irreversible and untreatable," the hospital said in a statement.