A general hospital acted unlawfully by preventing a frail 93-year-old woman with dementia leaving there due to its concern discharge was not in her best interests, the Court of Appeal has ruled.

Mr Justice Gerard Hogan said the case raised legal and constitutional issues of "far-reaching importance" regarding care and welfare of the infirm elderly.

Outside the Mental Health Act 2001, and the special circumstances of the Health Act, enabling detention of those with infectious diseases, the concept of detention "really has no place in our system of medical care".

While he could sympathise with the hospital, its "self-created" power of detention might if unchecked, lead to "widespread abuse".

Article 40.1 of the Constitution provides all detention must be in accordance with law and no power to detain this woman was identified.

The reasons of the detainer were not relevant and there was "simply no halfway house" between liberty "unfettered by restraint and an arrest".

If the courts were to accept this self-created power of detention, the "logical consequences" would be tens of thousands of people with dementia or impaired capacity in nursing homes and similar institutions might be restrained leaving.

While that could in many cases be done for good clinical reasons, it might also be done for convenience and, perhaps in a small minority of cases, "for less noble reasons".

There is no statutory power equivalent to Section 23 of the Mental Health Act 2001, under which a psychiatric hospital can prevent a voluntary patient leaving for 24 hours, or any common law power permitting the hospital preventing the woman leaving at an appropriate time and place if she wanted to do so.

The common law has always rejected the claim personal liberty could be compromised on such a basis and this applied even more in the context of a Constitution which commits itself to upholding the freedom and dignity of the individual and guarantees to protect the person in Article 40.3.2 and personal liberty in Article 40.4.1.

While some might think a hospital in this position should have the power to restrain an elderly patient with dementia leaving with no suitable care plan, any change in the law was a policy matter for the Oireachtas.

There was no doubt the hospital acted at all times in the woman's best interests, as it saw them, and she received excellent medical care there, he stressed.

It had concerns about her capacity and "well-founded" concerns about the attitude and "rather eccentric" behaviour of her son and daughter.

Her daughter was seen covering her mother in cayenne pepper on one occasion and the family had also bought their mother an exercise bike.

The son in July 2016 sought a High Court inquiry under Article 40 of the Constitution into the legality of his mother's hospital detention after it refused to allow her to leave with him in June 2016.

President of the High Court Mr Justice Peter Kelly rejected two challenges over her detention and also directed an inquiry into her capacity, leading to her being made a ward of court in August 2016 and being moved to a nursing home where she remains.

Giving the COA judgment allowing the son's appeal over the High Court findings of lawful detention, Mr Justice Hogan, with whom Mr Justice Michael Peart and Ms Justice Máire Whelan agreed, said the only issue in the appeal was a legal one - whether the hospital was entitled to prevent the woman leaving. It was not.

The woman was admitted to hospital in autumn 2015 after falling at home and breaking her right hip.

She was discharged to her son's home but had another fall, broke her left hip and was readmitted to the hospital.

Given her frail condition, dependence, and variable incontinence, the hospital considered her needs would be best met in a nursing home on discharge and she lacked the capacity to participate in decisions on future discharge.

After she signed a self-discharge letter in June 2016, the hospital considered it would not be feasible to set up a care package at short notice and was concerned about her son's erroneous belief the HSE would be liable for all costs of care post discharge.

It took the view she lacked capacity to decide on discharge and her physical frailty and mental state were such it asked gardaí to prevent her leaving with her son the following day.