The so-called Snoopers' Charter has been ruled "unlawful" by the High Court in London following a legal challenge brought by Labour MP Tom Watson.
Watson, represented by human rights campaign group Liberty, launched a legal challenge against the Data Retention and Investigatory Powers Act (DRIPA) back in 2014 - the latest in a string of surveillance laws governments of all colours have sought to implement for the past decade or more.
Watson had argued that the Act, which was rushed through parliament, breached British people's rights and was "incompatible" with both the European Convention on Human Rights and the EU Charter of Fundamental Rights.
The challenge had cross-party support from Conservative MP David Davis, who dropped out following his appointment as Brexit secretary in 2016.
"The Data Retention and Investigatory Powers Act does not answer the concerns of many that the blanket retention of personal data is a breach of fundamental rights to privacy," he said at the time.
On Tuesday, Liberty announced that the Court of Appeals has sided with the challenge, ruling that, that DRIPA broke the law and breached British people's rights. By extension, therefore, the later Investigatory Powers Act 2016 is also likely to be ruled illegal.
Judges said that the law "did not restrict access to this data, in the context of the investigation and prosecution of crime, to the purpose of fighting serious crime, and "let police and public bodies authorise their own access, instead of subjecting access requests to prior authorisation by a court or independent body".
Liberty claims that the ruling means that significant parts of the Investigatory Powers Act 2016, better known as the 'Snoopers' Charter', are effectively unlawful and must be urgently changed.
Half-baked plans... do not even fully comply with past court rulings requiring mandatory safeguards
While the government has already put some safeguards in place in anticipation of Tuesday's ruling, Liberty has slammed the "half-baked plans" that "do not even fully comply with past court rulings requiring mandatory safeguards".
Liberty director Martha Spurrier said: "The government must now bring forward changes to the Investigatory Powers Act to ensure that hundreds of thousands of people, many of whom are innocent victims or witnesses to crime, are protected by a system of independent approval for access to communications data."
Watson is also calling for the government to act. He said: "This legislation was flawed from the start. It was rushed through Parliament just before recess without proper parliamentary scrutiny.
"The government must now bring forward changes to the Investigatory Powers Act to ensure that hundreds of thousands of people, many of whom are innocent victims or witnesses to crime, are protected by a system of independent approval for access to communications data."
Liberty, separately, is challenging the so-called Snoopers' Charter in a case that will go to the High Court later this year.
Buyers can demand refunds if they've had a game for no more than 14 days and not registered more than two hours of play
Total lunar eclipse 2019: 'Super Blood Wolf Moon' to be visible across Europe and North America on Sunday night
Moon will turn reddish-orange in colour during this weekend's total lunar eclipse
Hackers to compete for prize money of between $35,000 and $250,000 cracking the Tesla Model 3 at this year's Pwn2Own contest
Supermassive black holes can suddenly 'switch on' to devour large amounts of gases in their surroundings
Scientists are unsure what causes this dramatic increase in black holes' mass