British spies suffered a serious legal setback after the High Court ruled that a data retention bill was incompatible with EU law.
The Data Retention and Investigatory Powers Act (Dripa) was rushed through Parliament last July in a bid to ease the collection of phone and Internet data, but now faces partial nullification.
David Davis, a Conservative MP who challenged the bill, told the BBC: "This is a massively important ruling.
"The court has told the government to go away and rewrite the law on the collection of all our phone data, our email data, who we call, when we called them, where we were when we called them – all that sort of data.
"And they’ve said go away and rewrite it so before anybody gets at it – the agencies, the police, whatever – somebody independent gives approval."
Following the judgement the Home Office has until March to appeal, after which the aspects of Dripa that conflict with EU law will be struck down.
Writing in the judgment David Bean, a lord justice, cited the EU’s bill of rights, which protects a person’s private life, communications and personal data.
He also pointed to a case involving Digital Rights Ireland, which led to the EU Data Retention Directive being declared invalid last year, making it harder for member states to arrange bulk data collection.
Hailing the High Court decision, James Welch, legal director for the Liberty advocacy, said: "Liberty has long called for fundamental reform of our surveillance laws to ensure the public’s rights are properly respected by our Government – the chorus of voices demanding change is now growing.
"Now is the time for the home secretary [Theresa May] to commit publicly to surveillance conducted with proper respect for privacy, democracy and the rule of law – not plough on with more of the same."
The decision comes as a blow to the Home Office, which is gearing up to push the so-called Snooper’s Charter through Parliament, requiring telecoms companies to retain records of Internet and online smartphone activity.
The bill had previously been blocked by former Conservative coalition partners the Liberal Democrats, and was promptly resurrected by May after the Tory general election victory earlier this year.
Defending government snooping last July, May said: "Communications data has played a significant role in every Security Service counter-terrorism operation over the last decade.
"It has played a significant role in the investigation of many of the most serious crimes in recent time, including the Oxford and Rochdale child grooming cases, the murder of Holly Wells and Jessica Chapman and the murder of Rhys Jones."