A leading expert in national security and counter-terrorism has told the High Court that data retention regimes need to be broad in their scope if they are to be effective in the detection and prevention of serious crime.

Professor Michael Clarke, who is a defence studies expert at King’s College London and a former director of the Royal United Services Institute think tank, said restricting data retention regimes would create "electronic spaces" of "unknowable extent" in which criminals and terrorists could operate more freely and with virtual impunity.

He said retained data was used in 90% of investigations into serious crimes in the UK, and in 100% of investigations into terrorism.

He added that retained data has become particularly important across Europe in investigations into cybercrime and child sex offenses.

Prof Clarke was giving evidence on behalf of the State and the Garda Commissioner on the sixth day of an action brought against it by convicted killer Graham Dywer, aimed at having provisions of Ireland's data retention laws struck down.

The UK-based professor had commenced giving evidence before Mr Justice Tony O'Connor last week, however due to the bad weather he resumed his testimony on Tuesday via video link.

In reply to Seán Guerin, SC for the State, Prof Clarke said that he did not believe any other form of data retention regimes, such as targeted regimes against certain persons or geographical areas,  would be "operationally feasible" and "of little practical help".

Any jurisdiction that introduced some alternative to a general data retention scheme would be choosing to take some considerable degree of risk.

He said that restrictions on general schemes would mean detection and evidence gathering could not be performed as effectively as they done under the data retention regimes in Ireland and the UK.

Under cross-examination from Remy Farrell for Dwyer, Prof Clarke said he "could not square" findings by the ECJ and in a report by former chief justice John Murray that general and indiscriminate data retention regimes amounted to "mass surveillance".

He said the retention of large amount of data in itself did not amount to surveillance. However he did accept that when such data is accessed it did raise "privacy issues."

In his action, Dwyer claims the 2011 Communications (Retention of Data) Act, which allowed gardaí obtain and use data generated by Dwyer's mobile phone during his 2015 trial for the murder of childcare worker Elaine O'Hara breached his privacy rights.

The material obtained under that Act should not have been used at his trial, he claims.

Dwyer argues the 2011 Act was introduced to give effect to the 2006 EU directive concerning the retention and use of data.

The European Court of Justice found in 2014 the directive was invalid and that position was further strengthened in subsequent rulings by that court in 2016.

Dwyer's claims the 2011 Act suffers from the same flaws identified by the ECJ.

 In proceedings against the Garda Commissioner, and the State, Dwyer seeks various declarations that his privacy rights under the Irish Constitution, European Convention on Human Rights and the EU Charter have been breached.

Dwyer, 45, denies killing Ms O'Hara, and his appeal against his conviction is pending before the Court of Appeal. Dwyer's application is opposed.

The hearing continues.