"The legal advice ... was that the State did not have a leg to stand on."

So said Taoiseach Leo Varadkar in the Dáil today.

He was referring to the story broken last night by RTÉ Investigates, which revealed that the State wrongly withheld allowance payments from as many as 12,000 people with disabilities.

But if the State didn't have a leg to stand on, why did it pursue a legal strategy of contesting claims from vulnerable people who had been denied their payments?

Confidential documents obtained by RTÉ Investigates reveal that successive governments, involving all three current coalition parties, took this approach over a number of years.

The documents tell us several things about how the State handled these cases up until today.

It began in 2006 when a claim was initiated on behalf of a woman who suffered from schizophrenia and was admitted to a psychiatric facility in 1983.

Read more:
Up to 12,000 vulnerable people denied disability payment by State
Government to look at denied disability payments - Taoiseach

This woman had been in receipt of disability allowance prior to her admission but, within weeks, this was stopped.

The allowance, worth the equivalent of €50 per week at the time, was stopped because ministerial regulations introduced in 1981 demanded it.

This morning in the Dáil, the Taoiseach offered his understanding of why the allowance was not paid to people in institutional care.

Mr Varadkar said the allowance "was paid to people who could not provide for themselves".

"The policy position at the time, rightly or wrongly, and this is going back to the 70s, 80s and 90s, was that this money was no longer required, as the individuals were living in State-funded residential care and those needs were being met," he said.

The case taken on behalf of the woman in 2006 said the regulations were in conflict with the law and were therefore ultra vires, which means they had no legal standing.

A settlement was reached in 2008 and, on the day, there was media speculation that it could trigger a number of cases.

But these did not emerge, and there was no explanation as to why the State decided to settle.

The Taoiseach has said the State 'does not have a leg to stand on'

The documents show that, in 2009, the Minister for Health and the Minister for Social and Family Affairs prepared a joint memo for Cabinet to assess the potential implications of the case.

The memo showed that the legal advice from the Attorney General was that "the State was extremely unlikely to be able to defend this case".

While the individual payout was not significant, the number of potential other cases was.

The memo also indicated that a redress scheme was considered, but would not be activated unless more cases were taken.

At the time, the State believed that more than 12,000 people could be owed back payments, amounting to a sum that would have exceeded €700 million.

The document explicitly laid out the logic for not doing more investigation to assess the likely cost.

The memo said a "comprehensive trawl" could be done on "HSE administrative records, covering a 30-year period" and looking at 140 different care settings.

But it said "such an exercise would be unlikely to escape media attention or speculation and could generate further claims which otherwise would not have been made".

However, this was not the end of the matter.

Further documents obtained by RTÉ Investigates show that the State's policy was updated and continued.

This was despite indications that the legal advice on the cases was even more damning than had originally been identified in the 2009 document.

In 2010, the Cabinet was asked to agree a continuation of the strategy. A memo asked it to "support the HSE in not acceding to any claims for back payment of [the Disabled Persons' Maintenance Allowance] (other than in the context of legal proceedings)".

Confidential documents show that successive governments pursued this strategy over a number of years

Then, in 2011, when Fine Gael and the Labour Party replaced the Fianna Fáil/Green Party coalition in government, another brief was prepared on the issue.

This memo, prepared by the Department of Health, described the issue as "the greatest potential exposure in the disability litigation area".

The memo also summarised the counsel's advice that was given at the time of the High Court settlement.

This said that the regulations, which provided for the withdrawal of the allowance, were "plainly ultra vires and void".

This was different in character to the 2009 message.

It indicated not just that the State did not feel it couldn't defend the case, but also that it had been advised that the regulations themselves had no legal basis.

Yet no action appears to have been taken on this.

The same language was echoed in a confidential memo circulated to a limited number of senior ministers in 2012, which also included details of one further case that had been taken and settled.

Still, the strategy did not change.

These key documents show the State unequivocally knew that the basis on which it took money from disabled people in institutional care had no legal basis. Or, as the Taoiseach said bluntly today, that "the legal advice in relation to DPMA was that the State didn’t have a leg to stand on".

But these people remained in long-term institutional care and were no better off until the strategy ultimately came to light because of documents shared by Department of Health whistleblower Shane Corr.