Doctors have been granted permission to switch off a life support machine keeping a clinically-dead woman alive because she is pregnant.
In a landmark ruling, Dublin's High Court said keeping the young mother alive would deprive her of dignity in death and subject her father, partner and two young children to "unimaginable distress" in a "futile exercise".
The panel of judges said it was in the best interest of the unborn child to authorise the withdrawal of life support in what was a "tragic and unfortunate case".
The High Court added that it was a case of "great public importance".
The 26-year-old was pronounced clinically dead on December 3 after suffering a trauma injury last month.
Her family had sought to switch the equipment off to preserve her dignity.
But doctors refused, fearing they might be prosecuted under strict Catholic-influenced abortion laws, which give the 18-week-old foetus the same constitutional rights as the mother.
Under the Irish constitution, the foetus is regarded as a citizen.
In their ruling, president of the High Court Mr Justice Nicholas Kearns, Ms Justice Marie Baker and Ms Justice Caroline Costello agreed the unborn baby had little chance of survival.
"The condition of the mother is failing at such a rate and to such a degree that it will not be possible for the pregnancy to progress much further or to a point where any form of live birth will be possible," they said.
Medical evidence showed the unborn child was facing into a "perfect storm" with no realistic prospect of emerging alive.
Doctors with the best interests of both the mother and unborn child do not believe there is any medical or ethically based reason for continuing with the "grotesque" process, the court was told.
The woman's father took the case against the Health Service Executive (HSE) after agreeing with the woman's partner that the life support should be switched off.
"He wanted her to have a dignified death and be put to rest," the court ruling stated.
"His daughter's two children are aware that their mother is sick and believe she is being looked after by the nurses 'until the angels appear'."
There is to be no appeal of the decision by either side in the case.
Paul Connors, communications director with the HSE, said it was a very welcome decision at the end of a very traumatic number of days for the woman's family.
"Certainly, it brings a great degree of clarity to these particular situations," he said.
Health Minister Leo Varadkar said he would be carefully examining the ruling.
"I wish to convey my heartfelt sympathies to the family and partner of the woman at the centre of this case at this most difficult time - particularly given the season," he said.
"This case and the judgement will need to be carefully examined before I can make any further comment on it.
"In the meantime, I would ask that the privacy of this family is respected, at this so difficult and challenging time."
During the case, which was fast-tracked through the High Court, harrowing evidence was given by the woman's father and her partner - who cannot be named in order to protect their privacy - as well as seven doctors.
The woman suffered a head wound in a bathroom fall in hospital on November 29 after being admitted for nausea and headaches.
A catastrophic fluid build-up in her brain led to her being declared clinically dead four days later.
Such is her physical deterioration since then that one of her children was left very distressed at her appearance when she last saw her, the High Court was told.
Dr Frances Colreavy, an intensive care specialist, had told the court she inspected the woman's body on Monday and found it unrecognisable compared to a photo of her by her bedside.
Having practised medicine for decades in Ireland and Australia, she had never witnessed a clinically-dead person being kept on life support for so long, the court was told.
She said the woman's blood was becoming increasingly toxic.
Dr Peter McKenna, former master of Dublin's Rotunda Maternity Hospital, said if the treatment was not halted it would go "from the extraordinary to the grotesque".
The case has reignited debate over Ireland's constitutional ban on abortion which requires doctors to take all possible measures to protect the life of a foetus.
Irish doctors have appealed for decades for clearer legal guidelines on when they may terminate a pregnancy.
Thousands of Irish women travel to the UK every year for abortions.