Convicted murderer Graham Dwyer has won his legal action against the Garda Commissioner and the State over data from mobile phones.

The ruling could have implications for many other criminal cases and investigations.

The High Court found that the Irish legislation, which allows data from mobile phones to be retained and accessed, breaches EU law and the European Convention on Human Rights, because the retention of the data is general and indiscriminate, and there is no prior review by a court or an independent authority before it can be accessed.

And because there are no adequate legislative guarantees against abuse.

Mr Justice Tony O'Connor said the Court of Justice of the European Union has ruled that even the objective of fighting serious crime, could not justify such an indiscriminate regime of retaining data.

Dwyer was convicted by a jury three years ago of the 2012 murder of Elaine O'Hara.

Mobile phone metadata was an important part of the prosecution case, as it allowed the prosecution to show where Dwyer's phone was at certain times.

Gardaí were able to get the information under 2011 legislation brought in following a European Directive.

The legislation obliged service providers to hold on to the data for two years.

However, the directive was declared invalid by the Court of Justice of the European Union in 2014.

The judge said his declaration of incompatibility with EU law created an obligation on the courts to disapply the law in relevant cases. 

But the judge said it was not an automatic consequence that trials would collapse or that convictions would be quashed.

He said Dwyer and others would still have to address the rules relating to the admissibility of evidence.  

Mr Justice O’Connor said in these proceedings, Dwyer had only sought declarations that would allow him to make arguments at his appeal about excluding particular evidence.

The judge said it did not automatically follow that the fact that the telephony data used by the prosecution was retained and accessed contrary to EU law would lead to the quashing of the murder conviction.

The State had argued that the effects of any declaration that the legislation was inconsistent with EU law should apply to future cases only and that the effects of such a declaration should be suspended to allow the Oireachtas to amend the law.

But Mr Justice O'Connor said he had concluded that the legal system in Ireland could allow for an orderly consideration of the retrospective effects of the declarations on the adducing of evidence according to the particular circumstances of each case.

And he said suspending his declaration was not appropriate.

He said the consequences should be determined on a case-by-case basis and the trial judge as in the prosecution of Graham Dwyer was best placed to determine if it was fair and right to adduce specific evidence.

The judge said Dwyer had not established that the actual operation of the legislation from the time Dwyer's data was retained in November 2011 to its disclosure in October 2013 was inappropriate, unnecessary or disproportionate.

A date has not yet been set for Dwyer's appeal against his conviction.

Mr Justice O'Connor said the prospect of anything resembling the dehumanising and unpleasant society portrayed in the novel 1984, led him to say that organs of the State should tread carefully when trenching upon the dignity and privacy of the human person in the sphere of telephony data retention and access.

Just as crime is required to be investigated, he said, there should be transparency of use or abuse of power.

Notification, supervision and enforceable sanctions are means to limit abuses, the judge said.

He said the chilling effect on privacy and the rights of free expression and association by actual, feared and mandatory surveillance cannot be underestimated.