Two MPs and other campaigners have won a High Court battle against the Government over data laws which they say allow the police and security services to "spy on citizens" without proper safeguards.
The won a ruling from two judges in London that the Data Retention and Investigatory Powers Act (Dripa) is "inconsistent with EU law".
The decision was a victory for Conservative former shadow home secretary David Davis and Labour backbencher Tom Watson who brought the legal challenge with members of the public.
They say they are concerned to protect the confidentiality of their contacts with constituents and other members of the public - including whistleblowers - who might approach them with sensitive information.
Their case is backed by the human rights pressure group Liberty.
Liberty's legal director James Welch said after the ruling: "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.
"Campaigners, MPs across the political spectrum, the Government's own reviewer of terrorism legislation are all calling for judicial oversight and clearer safeguards.
"The High Court has now added its voice, ruling key provisions of Dripa unlawful. Now is the time for the Home Secretary 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."
David Davis, Conservative MP for Haltemprice and Howden, said: "The court has recognised what was clear to many last year, that the Government's hasty and ill-thought through legislation is fatally flawed.
"They will now have to rewrite the law to require judicial or independent approval before accessing innocent people's data, reflecting the new consensus amongst experts in the Anderson and Rusi reports. This change will improve both privacy and security, as whilst the Government gave Parliament one day to consider its law, the court has given almost nine months."
Tom Watson, Labour MP for West Bromwich East, said: "The Government was warned that rushing through important security legislation would end up with botched law. Now the High Court has said they must come back to Parliament and do it properly.
"The Government gave MPs one day to discuss the legislation which was wrongly represented as respectful of people's right to privacy: it has until March 2016 to make sure that the law is re-written. There must be independent oversight of the Government's data-collection powers and there must be a proper framework and rules on the use and access of citizens' communications data."
Lord Justice Bean and Mr Justice Collins declared that section one of Dripa "does not lay down clear and precise rules providing for access to and use of communications data" and should be "disapplied".
But the judges said their order on disapplication should be suspended until after March 31 2016 "to give Parliament the opportunity to put matters right".
The judges also granted the Home Secretary permission to appeal against their ruling.