Minister questions legality of mass tapping of calls and internet and demands to know extent to which Germans were targeted

The German government has expressed the growing public anger of its citizens over Britain's mass programme of monitoring global phone and internet traffic and directly challenged UK ministers over the whole basis of GCHQ's Project Tempora surveillance operation.

The German justice minister, who has described the secret operation by Britain's eavesdropping agency as a catastrophe that sounded "like a Hollywood nightmare", warned UK ministers that free and democratic societies could not flourish when states shielded their actions in "a veil of secrecy".

Sabine Leutheusser-Schnarrenberger sent two letters on Tuesday to the British justice secretary, Chris Grayling, and the home secretary, Theresa May, stressing the widespread concern the disclosures have triggered in Germany and demanding to know the extent to which German citizens have been targeted.

It is the first major challenge to David Cameron's government to publicly justify its mass data-trawling operation, which was revealed in documents leaked by the former US intelligence contractor Edward Snowden.

In a speech in the US on Tuesday night, William Hague defended joint US-UK spying programmes, saying they were conducted within a strict legal framework and it was necessary for governments to act in secret when working to stop terrorists.

Germany's chancellor, Angela Merkel, has made clear her frustration that many of the questions raised by the disclosures made by the whistleblower have gone unanswered by the Obama administration.

William Hague, the British foreign secretary, again dismissed concerns on Tuesday in a speech at the Ronald Reagan Library in California, saying Britain should have nothing but pride in its "indispensable" intelligence-sharing relationship with the US.

"Let us be clear about it: in both our countries intelligence work takes place within a strong legal framework. We operate under the rule of law and are accountable for it. In some countries secret intelligence work is used to control their people – in ours it only exists to protect their freedoms."

But writing in the Guardian, the former Conservative leadership contender David Davis disputes that view, saying Britain's intelligence agencies are only subject to law in theory.

He accuses GCHQ of circumventing "inconvenient laws" by handing over personal data to the US and raises the prospect of "extremely serious violation" of the rights of British citizens over the use of their personal data. The German justice minister, in her letters to Grayling and May, asks for clarification of the legal basis for Project Tempora and demands to know whether "concrete suspicions" trigger the data collection or whether the vast quantities of global email, Facebook postings, internet histories and phone calls are being held for up to 30 days as part of a general trawl.

She also demands to know whether the programme has been authorised by any judicial authority, how it works in practice and the precise nature of the stored data. The level of concern was reinforced by a phone call from the justice ministry to Ursula Brennan, permanent secretary at the Department of Justice in London.

"I feel that these issues must be raised in a European Union context at minister's level and should be discussed in the context of ongoing discussions on the EU data protection regulation," Leutheusser-Schnarrenberger writes, adding she wants it discussed at the next meeting of justice and home affairs ministers in July.

Britain is almost single-handedly blocking Europe's attempts to increase privacy protection for personal data in a new regime. The Home Office said it would not comment on "private correspondence", while the Ministry of Justice said only that it would respond to the letter in due course.

The Guardian's disclosure of GCHQ's secret decision to use more than 200 probes to tap into the transatlantic cables to monitor and store up to 30 days of the world's telephone and global traffic has sparked outrage in Germany and other European countries.

The leading German social democrat, Thomas Oppermann, has said the details of Project Tempora make it sound as if George Orwell's surveillance society has become a reality in Britain.

Leutheusser-Schnarrenberger's letters – sent to Grayling and May on the 110th anniversary of Orwell's birth on 25 June 1903 – are the most forceful expression yet of the German government's frustration and anger over the surveillance scandal. The German media has been filled in recent days with pundits and readers asking to what extent they have been spied upon and whether their government knew about the surveillance.

The Snowden revelations have drawn wide-scale comparisons in the last fortnight with Gestapo and Stasi techniques. "I thought this era had ended when the German Democratic Republic fell," Markus Ferber, a member of the European parliament, said in a Reuters interview.

On Tuesday night the British inventor of the internet accused the west of hypocrisy over online snooping.

Sir Tim Berners-Lee told the Times: "In the Middle East, people have been given access to the internet but they have been snooped on and then they have been jailed.

"Obviously, it can be easy for people in the west to say, 'oh, those nasty governments should not be allowed access to spy'. But it's clear that developed nations are seriously spying on the internet."

Konstantin von Notz, the interior affairs spokesman of the opposition Green party, told Deutsche Welle radio: "What's been going on here is against international law and must be stopped immediately." His party has scheduled a Bundestag debate on the topic. On Tuesday, Snowden's location was clarified by the Russian president, Vladimir Putin, who disclosed that the whistleblower was at a Moscow airport. The admission reversed days of Russian obfuscation and came hours after Putin's foreign minister said Russia had nothing to do with Snowden's travel plans.