Theresa May's attempt to introduce greater surveillance powers has suffered a major set back after an EU court ruled part of the UK's new laws are illegal.
The highest court in Europe has ruled that electronic personal data from email and other online communications can not be retained on a general and indiscriminate basis such as that required by the UK's Investigatory Powers Bill (IP Bill), dubbed the snooper's charter.
In a case initially brought by David Davis before being appointed Brexit minister, and Labour deputy leader Tom Watson with privacy group Liberty, the European Court of Justice today found that EU laws protecting privacy in electronic communications prohibit such national legislation.
The judgement found that a mass retention of data such as that required by the IP Bill "exceeds the limits of what is strictly necessary and cannot be considered to be justified within a democratic society".
The IP Bill, which passed its last hurdle in the Lords last month, forces internet service providers to hold web history data on all users for 12 months, and had been expected to soon get royal assent making the law official.
The ECJ said such national laws were permitted if it was targeted, clear and precise for fighting serious crime and "must provide sufficient guarantees of the protection of data against risks of misuse".
It also ruled that unless urgent, any access to collected data by authorities should be subject to prior review by a court or an independent body and that authorities should notify the person concerned that access to their data has been granted.
The ruling was welcomed by Watson.
"Most of us can accept that our privacy may occasionally be compromised in the interests of keeping us safe, but no one would consent to giving the police or the government the power to arbitrarily seize our phone records or emails to use as they see fit. It's for judges, not Ministers, to oversee these powers. I'm pleased the court has upheld the earlier decision of the UK courts," he said.
The case was originally brought against the Data Retention and Investigatory Powers Act (Dripa), however, the updated surveillance laws in the Investigatory Powers Bill contain similar powers.
“This has little effect on Dripa, which will be repealed at the end of the year. However, it could have significant implications for the new Investigatory Powers Act, which was only passed by parliament in November," said Linklaters counsel Peter Church.
The government said it will appeal the ruling.
“It will now be for the court of appeal to determine the case. The government will be putting forward robust arguments to the court of appeal about the strength of our existing regime for communications data retention and access," said a Home Office spokesperson.
"Given the importance of communications data to preventing and detecting crime, we will ensure plans are in place so that the police and other public authorities can continue to acquire such data in a way that is consistent with EU law and our obligation to protect the public.”