DUBLIN — A brain-dead pregnant woman was taken off life support Friday after a court ruled that her 18-week-old fetus was doomed to die – a case that exposed fear and confusion among doctors over how to apply Ireland’s strict ban on abortion in an age of medical innovation.

The three-judge Dublin High Court said that all artificial support for the woman should end more than three weeks after she was declared clinically dead. Her relatives gathered at a hospital in the Irish Midlands to bid farewell to the unidentified woman, who was in her late 20s and had two young children.

In their 29-page ruling, the judges accepted testimony from seven doctors who said the fetus couldn’t survive for the extra two months of development needed to be delivered safely. The doctors detailed how the woman’s body was becoming a lethal environment rife with infections, fungal growths, fever and high blood pressure.

Ireland has the strictest abortion ban in Europe, a reflection of the country’s heavily Roman Catholic population. But Dublin’s archbishop had suggested before the decision came down that he would have no objection to removing life support.

The woman suffered irreversible brain death on Dec. 3, four days after sustaining a severe head injury in a fall. She had already been hospitalized after doctors found a cyst in her brain.

Doctors refused family pleas to turn off a half-dozen machines that regulated oxygen, blood flow, nutrition and waste collection, citing fears they could be sued for negligence or even face murder charges if they cut life-sustaining support for the fetus.

One doctor testified that he and two colleagues couldn’t agree on how Ireland’s constitutional ban on abortion should be applied, given the lack of explicit laws or guidelines for such cases.

Other doctors described the woman as a corpse unrecognizable from the photo by her bedside. Another noted that the body was being pumped with drugs never authorized for use on a pregnant woman and described what they were doing as experimental and, if it persisted, grotesque.

The judges said the fetus faced “a ‘perfect storm’ from which it has no realistic prospect of emerging alive. It has nothing but distress and death in prospect.”

The woman’s life support, they said, was “being maintained at hugely destructive cost to both her remains and to the feelings and sensitivities of her family and loved ones.”

The court said it was wrong to continue to deprive the woman “of dignity in death and subject her father, her partner and her young children to unimaginable distress in a futile exercise which commenced only because of fears held by treating medical specialists of potential legal consequences.”

The Catholic Church questioned why secular authorities had not established clear guidelines for cases where a woman dies and doctors determine that the fetus can’t survive on its own.

“There is no obligation to use extraordinary means to maintain a life. That applies both to the woman and to the child,” said Dublin Archbishop Diarmuid Martin, who spoke before Friday’s ruling and declined to comment on the specific case.