Convicted murderer Graham Dwyer has won a significant legal battle in his attempt to have his conviction for murder overturned.

Europe's top court confirmed this morning that Ireland’s system of retaining and accessing mobile phone metadata breaches EU law.

Such data was a key part of the prosecution's case against Dwyer in 2015, when he was convicted of the murder of Elaine O'Hara in August 2012.

While the decision has implications for the investigation of crime across Europe, it does not mean Dwyer will automatically win his appeal.

Graham Dwyer was convicted in 2015 of the murder of Elaine O'Hara in August 2012

The court also outlined the circumstances in which the targeted retention of such data is permitted under EU law.

It confirmed that EU law precluded national legislation that provided for the general and indiscriminate retention of mobile phone metadata.

It said it had already held that the objective of combating serious crime, as fundamental as it may be, did not justify this.

Attempts by member states to combat criminal offences could not have the effect of justifying legislation allowing retention of data interfering with the rights of practically the entire population.

The court said it rejected submissions that particularly serious crime could be treated in the same way as a threat to national security.

It added that a genuine or current or foreseeable threat could justify indiscriminate retention of data for a limited period of time.

But this was distinguishable from a risk of tension or disturbances that affect public security or from serious criminal offences being committed.

We need your consent to load this rte-player contentWe use rte-player to manage extra content that can set cookies on your device and collect data about your activity. Please review their details and accept them to load the content.Manage Preferences

The court ruled, however, that EU law did not preclude certain legislative measures to combat serious crimes.

These include targeted retention of data limited to a certain category of people or geographical criteria.

This could include retaining data based on the average crime rate in a particular area or measures allowing retention covering areas, such as airports, which receive a very high volume of visitors.

It ruled that nothing in EU law prevented legislation allowing the identity of those who purchase pre-paid sim cards to be checked and information to be disclosed by the seller to national authorities.

In addition, it found that under EU law national authorities could order a freeze on data retention when they commence a criminal investigation.

It said this could extend to data relating to people other than a suspect if the data could shed light on such an offence.

The court also confirmed that a system of accessing such data must have independent oversight.

It further confirmed the Advocate General's opinion that a national court cannot limit a declaration that legislation breaches EU law to future cases only.

It also noted that the admissibility of evidence obtained by indiscriminate retention of data was a matter for national law.

Dwyer case will return to Supreme Court

This morning's decision by the Court of Justice of the European Union comes as little surprise.

Last November, a senior adviser to the court, published an opinion that indiscriminate retention of data was not allowed under EU law.

Member states had argued that investigating serious crime would be almost impossible if mobile phone metadata could not be retained.

The implications for Dwyer’s appeal are yet to be determined.

The case will now go back to the Supreme Court, which is likely to rule in his favour.

But his appeal will be determined by the Court of Appeal, which will hear arguments about the admissibility of this evidence at his trial.

There is also a previous Supreme Court judgment that allows evidence to be admitted, even if a person’s rights are breached, as long as that breach was inadvertent or in good faith.

In a brief statement, a spokesman for Minister for Justice Helen McEntee said she had noted the judgment.

She said the case would now revert to the Supreme Court and the Department and the Office of the Attorney General would consider the Supreme Court's ruling when it is finalised.

She said it was expected this would bring clarity in what she described as an important area.

She said it would inform necessary legislation, supporting to the greatest degree possible, the work of An Garda Síochána to tackle crime and carry out effective investigations.

This legislation would take the CJEU's findings and the Supreme Court's ruling into account.

Green Party spokesperson on Justice Patrick Costello TD has said the ruling is "another indictment" of the State’s approach to data protection.

"The judgement should be a surprise to no one. Ireland has been repeatedly criticised for our national policies on privacy and data retention by numerous judgments, industry and campaigners," he said.

In a statement, a spokesperson for An Garda Síochána said it noted the judgment and would liaise with the Department of Justice on the matter.

The spokesperson said the force continues to use relevant legislation to prevent and detect serious crime.

It said it did not comment on matters before the courts.