An agreement allowing US spies to pull vast amounts of personal information on European citizens from Facebook has been ruled invalid by the European Court of Justice.
The judgment follows a legal challenge by a 28-year-old Austrian law student.
Max Schrems brought the challenge over concerns Facebook might be sharing the personal data of millions of Europeans with US intelligence agencies, including the National Security Agency (NSA), under a 15-year-old treaty known as the 'safe harbour' agreement.
The treaty was designed to provide a streamlined way for US firms to get data from Europe without breaking EU rules.
The EU forbids personal data from being transferred to and processed in parts of the world that do not provide adequate privacy protections.
Safe harbour allows US companies to self-certify that they are carrying out the required steps.
But in its ruling on Tuesday the European court declared the treaty invalid.
It said that allowing the authorities access to the content of electronic communications compromised the fundamental right to respect for private life.
Mr Schrems said: "I very much welcome the judgment of the court, which will hopefully be a milestone when it comes to online privacy.
"This judgment draws a clear line. It clarifies that mass surveillance violates our fundamental rights. Reasonable legal redress must be possible."
Mr Schrems complaint springs from the revelations of NSA contractor Edward Snowden.
Mr Snowden who blew the whistle on the NSA's wholesale collection of personal data, releasing hundreds of thousands of documents to the media.
Mr Schrem's legal challenge, funded through a crowd-sourcing campaign, was filed in Ireland as all Facebook users outside the US and Canada have a contract with Facebook Ireland.
The Dublin high court asked the European Court of Justice (ECJ) for a ruling which will now be sent back to the high court where the judges will use it as the basis for their decision.
The ECJ decision could have far-reaching consequences for technology companies including Google, Apple, Yahoo! and Skype.