Germany's foreign intelligence service violated the constitution by spying on internet data from foreigners abroad, the nation's top court ruled Tuesday in a victory for overseas journalists who brought the case.
The BND agency's surveillance violates "the fundamental right to privacy of telecommunications" and freedom of the press, judges at the Constitutional Court in Karlsruhe said in their verdict.
But given the "great importance" of foreign surveillance to German security, the court gave the BND until the end of 2021 to change its practices and comply with the law.
The ruling marked the first time the Constitutional Court clearly stated that the BND must respect fundamental rights accorded by the Germany's Basic Law constitution even when operating abroad.
German intelligence services are already not allowed to monitor the internet traffic of Germans in such a vast way.
The case was brought by journalists and civil society groups who were outraged after the BND was granted sweeping new powers to carry out "strategic telecommunications surveillance" under amended legislation in 2016.
This allowed the BND to tap into internet traffic from non-Germans abroad, often through monitoring the use of keywords, phone numbers or email addresses, and to share this information with other secret services.
One of the plaintiffs, media watchdog Reporters Without Borders (RSF), argued that this allowed the agency to spy on journalists "almost without restrictions".
"The journalists' mission of monitoring the activities of the state is rendered ineffective if these states are listening in on their conversations while they do their research," said RSF on its website.
The mass surveillance also deterred sources from contacting reporters covering topics such as corruption, tax fraud and human rights abuses, it argued.
The group hailed the verdict, saying it set a new benchmark for human rights and press freedom.
"We're very pleased that Karlsruhe has clamped down on the escalating surveillance practices of the federal intelligence service abroad," said Christian Mihr, RSF's Germany director.
"The big victory is that German authorities cannot get out of their constitutional obligations by going abroad and working there," said Nora Markard from the GFF Society for Civil Rights, another of the co-plaintiffs.
Crucially, the judges agreed that foreign intelligence gathering was necessary to keep Germany safe and was in theory not incompatible with the constitution.
But it had to be justified and proportional, they warned, whereas the BND's current snooping is "not tied to specific grounds or suspicions".
The judges called for stricter rules to govern the BND's overseas internet monitoring, including clearly defined thresholds to decide who should be targeted, and limits on sharing and storing the collected data.
An independent body should be created "that allows for comprehensive oversight and control of the surveillance process", they said.
Legislators have until December 31, 2021 to make the necessary changes to German law.
The BND said it would study the verdict closely and cooperate with the government and lawmakers on the matter.