European judges rule against Theresa May's 'Snoopers' Charter'
The "indiscriminate" retention of emails and other electronic communications data by governments is illegal, European judges have ruled.
The European Court of Justice concluded that the governments should only target data belonging to individuals suspected of serious crime.
Theresa May's Data Retention and Investigatory Powers Act, which she introduced as Home Secretary, had required companies to retain data for a year for state use.
The court ruling came in response to a challenge by Labour's Tom Watson and Tory David Davis before he became Brexit Secretary.
Davis withdrew his support for the legal challenge in July following his appointment as part of May's cabinet.
Watson said he was pleased with the court's decision adding: "It's for judges, not ministers, to oversee these powers."
"The fact that the data is retained without the users of electronic communications services being informed of the fact is likely to cause the persons concerned to feel that their private lives are the subject of constant surveillance," the court said in its ruling.
"Consequently, only the objective of fighting serious crime is capable of justifying such interference. "
Legislation which provided for the "general and indiscriminate" retention of data "exceeds the limits of what is strictly necessary and cannot be considered to be justified within a democratic society," it said.
The Data Retention and Investigatory Powers Act, which was passed by the coalition Government in 2014, expires at end of the year but has since been superseded by the expanded Investigatory Powers Act.
The civil rights group Liberty, which supported the court challenge, said the Government would be forced to amend the law as a result of the European court ruling.
Liberty director Martha Spurrier said the judgment "upholds the rights of ordinary British people not to have their personal lives spied on without good reason or an independent warrant."
"The Government must now make urgent changes to the Investigatory Powers Act to comply with this," she added.
"This is the first serious post-referendum test for our Government's commitment to protecting human rights and the rule of law. The UK may have voted to leave the EU - but we didn't vote to abandon our rights and freedoms."
The case was originally referred to the judges in Luxembourg by the Court of Appeal and it will now consider how the ruling will be applied.
The Home Office said it would be putting forward "robust arguments" in support of the current regime for data retention.