The European Union's highest court has ruled as illegal "general and indiscriminate retention" of emails and electronic communications by governments, media reported on Wednesday.
The judgement by the European Court of Justice comes as a blow to Britain's new Investigatory Powers Act - the so-called snooper's charter, said a report in the Independent.
Britain's Investigatory Powers Act passed into law in November, granting the government powers to indiscriminately hack and store data relating to Internet use.
Only targeted interception of traffic and location data in order to combat serious crime is justified, the European Court of Justice (ECJ) said in Luxembourg, boosting the case against the sweeping collection of emails, text messages and Internet data.
The case was brought to the European court by Brexit Secretary David Davis and Labour Party's deputy leader Tom Watson over the legality of British intelligence and security organisation GCHQ's bulk interception of call records and online messages.
The duo had already won a high court victory on the issue, but the government appealed and the case was referred to the ECJ.
The decision could prove inconsequential after Britain withdraws from the EU, when the European Court of Justice will no longer have jurisdiction over the government.
"This ruling shows it is counter-productive to rush new laws through Parliament without proper scrutiny," said Watson.
"At a time when we face a real and ever-present terrorist threat, the security forces may require access to personal information none of us would normally hand over."
"That's why it's absolutely vital that proper safeguards are put in place to ensure this power is not abused, as it has been in the recent past," he said.
Martha Spurrier, director of the human rights group Liberty, said: "Today's judgement upholds the rights of ordinary British people not to have their personal lives spied on without good reason or an independent warrant."
However, the British government vowed to appeal against the decision.
A Home Office spokesperson said: "We are disappointed with the judgement and will be considering its potential implications."
"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," the spokesperson said.