The European Court of Justice (ECJ) has blocked a planned EU agreement to share details of airline passengers with Canada designed to help in the fight against terrorism and international crime.
The Luxembourg-based court ruled that the 2014 agreement was "incompatible with the fundamental rights recognised by the EU", because it would have meant individuals' sensitive personal data being held for five years, even where there was no indication they were involved in illegal activities.
Online privacy campaigners said the ruling had "massive implications" for Brexit, as the same approach can be expected to be applied to any future trade agreement between the UK and EU, making the prospects for a deal involving digital communications "fragile".
The agreement was referred to the ECJ by the European Parliament, in the first time that the court has been asked to rule on the compatibility of a draft international agreement with the EU's Charter of Fundamental Rights.
The court found that the transfer and retention of passenger name record (PNR) data "requires a precise and particularly solid justification, based on grounds other than the protection of public security against terrorism and serious transnational crime". And it concluded: "In this instance, however, there is no such justification."
The data involved could include information on individuals' travel itineraries, relationships, financial situation, dietary habits and health and may even cover more sensitive areas, such as race, sexuality or religious belief, said the ruling.
The court found: "The provisions of the agreement on the transfer of sensitive data to Canada and on the processing and retention of that data are incompatible with fundamental rights ... The envisaged agreement may not be concluded in its current form."
The executive director of the online privacy and free speech campaign Open Rights Group, Jim Killock, said: "This decision has massive implications for Brexit.
"The EU courts have rejected an agreement that failed to protect fundamental rights, including the rights to privacy and protection of personal data.
"Any future trade agreement between the UK and EU would be subject to the same stringent requirements. Given the UK's mass surveillance laws and indiscriminate data retention, any trade agreement for digital, communications and even banking and insurance businesses, could look very fragile indeed."