The eus top court has ruled to limit national governments ability to force tech companies to gather troves of their users data for surveillance purposes, further complicating efforts by brussels to agree on a post-brexit data-sharing deal with the uk.

The european court of justice on tuesday confirmed that national governments could not force internet and phone companies to store information such as location data and metadata in the name of crime prevention or national security, a practice that is widespread among national security agencies in europe.

The ecjs legal decision, which applies to the general and indiscriminate use of such practices in the absence of a serious threat, followed challenges brought by privacy advocates, including the uks privacy international and frances la quadrature du net, arguing against policies that they said violated peoples basic rights.

Legal experts warned the ruling represented a setback for the uk when it comes to securing an adequacy decision on data transfers from brussels in time for brexit, which would allow data to be transferred to the uk without the need to put additional safeguards in place.

Todays decision is a blow to the uks hope to get an adequacy decision from the eu, said estelle masse, senior policy analyst at access now. the eu court found that uk surveillance measures on bulk retention and access of communication data are incompatible with eu fundamental rights.

Brussels decides which states it will agree to share data with by assessing their data-privacy regulations and comparing them to its own. only those countries that meet its criteria are permitted to share data with the eu without additional safeguards.

More than a dozen adequacy decisions have been granted to countries around the world, including japan, switzerland and israel. however experts argue that in light of the new ruling, the uk may struggle to secure an agreement with brussels in time for decembers brexit deadline, since such data-gathering practices are still permitted under uk law.

Talks on the issue of post-brexit data-sharing between the uk and the eu have so far moved slowly. brussels officials acknowledge that problems have arisen both because of signals from the uk that it wants to diverge from eu rules, and also because of the extremely high bar set by eu jurisprudence.

A failure to reach an adequacy decision would lead to significant additional costs for companies engaged in eu-uk data transfers, said edward machin, data privacy and cyber lawyer at ropes & gray. in addition to instituting new clauses for data transfers, they could also be required to conduct costly and resource-intensive legal analysis of the uks data framework.

Eduardo ustaran, a privacy lawyer and partner at hogan lovells, warned that the chances of the uk and the eu reaching an agreement in time for brexit were slim. reaching a deal on bulk data collection as we approach the december deadline will be a tall order, he said.

The move by brussels follows a similar ecj ruling in july to invalidate parts of a transatlantic agreement on data-sharing known as privacy shield, which allowed thousands of companies to transfer information between the eu and the us. following a complaint from privacy activist max schrems, the court found that europeans did not have sufficient access to legal redress in the us under privacy shield.

Even if an adequacy decision were granted for the uk following the latest ruling, privacy activists would still likely bring a court case against it, said mr machin.

The last thing the european commission will want is to give an adequacy decision and then have someone like max schrems launch an action and perhaps a year later for the ecj to strike it down and leave them with more egg on their face, he said.