A hospital trust has been given a High Court judge's permission to withhold resuscitation treatment from a dying patient with advanced dementia, if his condition deteriorates.
The judge said the 83-year-old man should be allowed to "die with dignity" despite strong objections from his daughter, who said her father's view had been "only God should decide when it is his time".
The daughter said they were a "God-fearing" family, and she and her father had been caused "immeasurable distress" after a "do not resuscitate" (DNR) notice was placed on his file at the Great Western Hospital, Swindon, Wiltshire.
She said in a witness statement that after her mother's death over 20 years ago "dad told me that if he had a heart attack he would want to be resuscitated".
But Mr Justice Keehan, sitting in the Court of Protection, ruled that cardio-pulmonary resuscitation (CPR) would be "positively harmful", if successful, and not in the best interests of the patient, referred to as GH.
The judge said: "He has a right to die peacefully with dignity and should be permitted to do so".
He granted a declaration to the Great Western Hospital NHS Trust that it would be lawful and in GH's best interests to withhold CPR if he suffers respiratory or cardiac arrest, or some other life-threatening deterioration.
Nerissa Vaughan, the hospital trust's chief executive, said: "We always do everything we can to provide patients at the end of their lives and their loved ones with compassionate care.
"Our experienced medical and nursing teams have a professional and ethical duty not to cause patients unnecessary pain or harm.
"The patient is always our priority and all decisions are made to ensure a comfortable and dignified end to life.
"We have been in regular contact with (the daughter) and continue to offer her our full support."
The judge said GH was suffering from health problems associated with the terminal phase of his dementia, including pneumonia, type 2 diabetes, hypertension and cerebrovascular disease that had led to strokes
His daughter "AB", who has power of attorney in relation to matters relating to his health, was constantly by his side after moving to live close to him in 2007. She was his main carer.
In late 2010 or early 2011 he was diagnosed with the onset of dementia and it was now agreed he lacked capacity to make decisions for himself.
But his daughter did not believe it was in her father's best interests to completely withhold CPR and wanted it available in a limited form, said the judge.
She said in a witness statement before the court that her parents were both "God-fearing people and avid churchgoers", and her mother had died in church after suffering a heart attack there.
The daughter added: "We specifically discussed CPR because of what had happened to my mother and my dad told me that if he had a heart attack he would want to be resuscitated.
"I know he would have been adamant that every effort should be taken to prolong his life and that only God should decide when it is his time."
The court heard AB's half-brother disagreed with her. He described their father as a "very proud, strong and independent man" who would not want to be kept alive in circumstances where "he would feel he had no dignity".
Allowing the hospital trust's application, the judge said the father's views about CPR in the context of his wife's death had been expressed when he was a relatively fit man and had little relevance now that he himself was dying.
The judge said: "From all I know of GH, and what I have read and heard about him, I have little doubt that he will accept death as God's will."
The judge ruled that even if CPR were successful, GH's death would be put off for only days or weeks, and the likelihood would be he would suffer pain as a result of the efforts to resuscitate him.
There was a very real risk that his level of consciousness would be reduced by painkillers to such an extent that he would be unaware of the presence of his daughter.
The judge concluded: "The CPR procedure, if successful, would be positively harmful. In my judgement, after a long and happy life, GH is entitled to a dignified and peaceful death."
The judge said the declaration sought by the hospital trust "is manifestly in his best interests and I approve."
The judge refused the daughter permission to appeal, but she can still make an urgent application to the Court of Appeal to consider her case.