In a place where government surveillance raises the spectre of a totalitarian past, some fear rights are being violated.

Berlin, Germany – When former US intelligence contractor Edward Snowden blew the lid off the United States’ vast surveillance programme three years ago, shockwaves coursed through Germany. Protesters took to the streets to voice their anger. For privacy-mindful Germans, news that the National Security Agency (NSA) had spied on allies and even listened in on Chancellor Angela Merkel’s mobile phone was outrageous.

“Spying on friends just isn’t done,” Merkel was quoted as saying after the news broke. But the story shifted quickly.

It emerged that German intelligence services had been working in close cooperation with the NSA, and had even spied on European allies at the behest of the Americans.

The German media and public demanded answers, and a fact-finding commission was quickly put into action in parliament. Even the intelligence director at the time wanted to reform his agency and focus more on key competencies.

Three years later, the uproar is much subdued. The attacks in Paris and Brussels, the rise of the Islamic State of Iraq and the Levant (ISIL, also known as ISIS) group and the refugee crisis have posed new and unfamiliar challenges, and Germany has grown its security apparatus steadily in response.

The country’s 2009 anti-terrorism law has been sharpened to grant federal police and intelligence services more powers. Police presence has been boosted. The interior minister has proposed expanding video surveillance significantly, to include shopping centres, buses and sports events. And the government has stepped up cooperation between Germany’s intelligence agency, the Bundesnachrichtendienst (BND), and its European counterparts with a joint European intelligence database.

Berlin maintains that these measures are crucial to protecting Germany and its allies from myriad challenges, particularly “terrorism”.

Yet, in a country where privacy is paramount and government surveillance raises the spectre of a totalitarian past, opposition legislators, lawyers and activists are sounding the alarm over changes they say take direct aim at fundamental rights, and many have vowed to fight back in court.

New surveillance laws

Much of the debate surrounds the government’s espionage laws. The parliament, or Bundestag, passed legislation on October 21 that makes sweeping changes based on two separate pillars (PDF).

One allows the BND to intercept communications between foreigners, if a security threat can be averted or Germany’s ability to act is endangered. EU citizens and companies are also subject to surveillance, if the data they share is relevant to German or European security policy.

Until now, the BND could only tap into individual lines and access up to 20 percent of communications, but those limitations have been lifted with the new legislation.

Using “selectors”, key search parameters including IP and email addresses, the agency can now legally search and store data traffic for up to six months and then pass it along to partners like the NSA. Closer cooperation with allied intelligence agencies is also protected by the legislation.

The second pillar aims to strengthen oversight of Germany’s three intelligence services – the BND, the Federal Office for the Protection of the Constitution and the Military Counterintelligence Service. A new independent monitoring board of two federal judges and one federal prosecutor will carry out random checks on the BND’s work. The existing Parliamentary Control Panel has also been reformed to include a special commissioner.

The coalition government hailed the law as a major contribution to both transparency and security. Uli Groetsch, a Social Democrat (SPD) member of the Committee on Domestic Affairs and the Parliamentary Control Panel, said it was the most extensive legislation of its kind in the world.

“As domestic affairs lawmakers, we put a lot of stock in making sure our intelligence services have the necessary resources,” he told Al Jazeera. “We want to make sure that the BND can stay on a level playing field with other intelligence agencies.”

OPINION: The surveillance society is here

Constitutional Catch-22

Critics, however, say the law’s scale is precisely the problem, and they accuse the government of legalising the very surveillance tactics that caused such controversy in 2013.

Take the clause involving “foreign-to-foreign” telecommunications.

It is rooted in the NSA scandal; serious deficits in oversight and regulation were brought to the surface. Intercepting data on German citizens or residents is forbidden by Article 10 (PDF) of the German constitution, but there were no stipulations on foreigners.

The new legislation attempts to close the loopholes by explicitly allowing foreign espionage, as long as conditions are met. And the BND can also tap into international internet exchange points operating on German soil.

Klaus Landefeld, a member of the board at the internet industry association Eco International, says the law attempts to draw a clear line between foreigners and Germans, but today’s packet-oriented telecommunications make it nearly impossible to actually do so.

“When you tap a telecommunications line nowadays, you always get a mix of foreign traffic, national traffic and national-to-international traffic. But the way the law is written, they can access any line as long as there is some foreign communication on it,” he said.

Landefeld represents De-Cix, the world’s largest internet exchange point. The Frankfurt-based company filed a lawsuit against the German government in September, before the legislation was even passed. According to the complaint, the BND forced the company to allow access to its vast network and carried out mass surveillance, despite the company’s objections.

The legal battle also touches on a more fundamental issue.

Some constitutional experts believe that Article 10, which guarantees telecommunications privacy, is actually a fundamental human right for everyone, not just Germans. That interpretation would mean intelligence agents have been running afoul of the constitution for years and would continue to do so.

“My personal belief is we will have violations of our constitution at a rate of roughly one million each day. Which is completely unacceptable,” said Landefeld.

He has met intelligence officials and legislators to present suggestions for improvement, like streamlining the selector system.

“I see a tiny, tiny percentage of my data which only just might be illegal. And only a tiny fraction of that is something that law enforcement is interested in. Does that really justify storing all of it? Is that really acceptable?”

Coalition legislators argue it is. They say the ability to spy on foreigners is indispensable to shoring up security at home and abroad. Clemens Binninger, a member of Chancellor Merkel’s conservative party and a leading force in shaping the legislation, challenged fellow legislators during the parliamentary debate last October.

“How else is the BND supposed to protect us against “terrorism” besides listening in on conversations between people outside of Germany?”, he had questioned.

WATCH: The future of mass surveillance (9:16)

Flurry of litigation

Striking a balance between freedom and security is delicate anywhere, but nowhere more so than in Germany.

Germans harbour a deep aversion to surveillance after experiencing how data can be manipulated under both the Nazis and the former Communist East German state, and the NSA scandal triggered the deepest waves here.

German Chancellor Angela Merkel gives a speech at the 60th anniversary of the founding of the BND in Berlin, November 28, 2016 [Hannibal Hanschke/Reuters]

Opposition to the latest surveillance measures is growing. Former federal justice minister Sabine Leutheusser-Schnarrenberger announced that she would sue over the new BND legislation in the highest court. The Green Party has threatened to do the same once the law goes into effect on January 1.

Amnesty International has already lodged a constitutional complaint, claiming the BND is intercepting far more data than is actually allowed under current legislation.

The internet activist organisation Digital Courage brought together a group of authors, journalists and parliamentarians to file a lawsuit against a revised data retention law passed in October of 2015. It allows the government to collect and retain internet and phone information for 10 weeks.

And just last spring, Germany’s highest court actually struck down parts of the country’s anti-terrorism laws because some covert surveillance tactics were disproportionately broad and vague.

“There is a long history of battles between judges and parliament. The government and the majority in parliament are testing the limits of the constitution to see what can be done to allay fears of ‘terrorism’,” said Alexander Dix, the former Berlin commissioner for Data Protection and Freedom of Information. “There is a constant struggle between these two branches of the German state.”

What of Edward Snowden?

Meanwhile, the parliament’s fact-finding commission on the NSA affair has gained fresh wind after two years of little progress.

The Federal Court of Justice ruled this month that the German government must provide conditions for Snowden to testify in Germany, including witness protection. The majority of commission members wanted to question Snowden via video from Moscow to avoid a showdown with Washington. But Snowden, who is wanted in the US on espionage charges, refused.

The possibility that he could take the stand in Germany poses significant challenges.

“To this point, nobody has been able to explain how we would be able to bring Edward Snowden to Germany. You can try to pick him up in Russia, bring him to Germany and take him back but I don’t think it’s feasible,” said Uli Groetsch, the domestic affairs parliamentarian. “I think it’s right and sensible to question him, but the question of how to do so is not that easy.”

Snowden’s leaks may not have derailed Berlin’s cosy ties with Washington, but his testimony in Germany very well could, and the consequences for the BND would be critical. They rely heavily on their American counterparts’ broad and deep spying infrastructure; it was the NSA, after all, that handed over selector lists to tell the BND what to search.

“If the Americans would turn off the flow of information from one day to the next, we would have a significantly elevated risk here in Germany,” said Nikolaos Gazeas, a Cologne-based lawyer and expert on intelligence law.

“We do depend a good deal on the knowledge and information of American intelligence services, partly because the American apparatus is much larger than ours and carries out far more information gathering. But it’s also a division of labour.”

OPINION: Will Putin expend Snowden for Trump?

Freedom or security

That close cooperation drove protesters to the streets in 2013.

Today, analysts say growing fear among Germans, in the face of attacks and crime, might be changing their penchant for privacy.

A January study from public broadcaster ARD and Berlin-based survey institute Infratest Dimap shows that more than 80 percent of those polled believe Germany should institute more video surveillance in public spaces.

“If you put the question in an abstract way, most people would agree that freedoms could be sacrificed in order to obtain more security,” said Alexander Dix. “But if it comes to individual cases, and if people are subjected individually to certain measures, they become more critical.”

Still, Digital Courage has already gathered more than 32,000 signatures from German citizens in its fight against the data retention law.

Leena Simon, an activist specialising in the philosophy of technology and privacy rights with the organisation, believes the narrative that people have lost interest in privacy issues is a myth.

She is fighting to make sure Germans remember and stay vigilant. Simon says she was just a teenager when the September 11 attacks hit the US, and she watched with growing dismay as the German government clamped down with anti-terror legislation of its own.

More surveillance would only exacerbate the problem, she believed, and her conviction spurred her to become an activist.

“I believe that what protects us more than anything else is our freedom. And when we give up our freedom now for supposed safety, then, in the end, we get the exact opposite. That is why we have to protect it.”