Image caption The minister had previously said the gathering of data sounded like a 'Hollywood nightmare'

Germany's justice minister has written to British ministers seeking information about allegations of mass surveillance by British intelligence.

Sabine Leutheusser-Schnarrenberger asked if the surveillance by GCHQ was legal and if Germans were targeted.

Previously she had said the gathering of vast amounts of global data sounded like a "Hollywood nightmare".

Meanwhile, civil rights group Liberty demanded an inquiry into whether its communications were accessed illegally.

The Foreign Office said it does not comment on intelligence matters. Foreign Secretary William Hague told parliament two weeks ago, though, that British security agencies uphold the law at all times.

Evidence leaked by Edward Snowden to the Guardian suggests that GCHQ is able to tap into and store internet data from fibre optic cables for 30 days in an operation called Tempora.

And GCHQ is also said to have accessed information about UK citizens from the US National Security Agency's monitoring programme, Prism.

'Germans fear spying'

GCHQ has insisted it is "scrupulous" in complying with the law.

Ms Leutheusser-Schnarrenberger's request for more information from the British government came after German Chancellor Angela Merkel voiced unease at the allegations in the Guardian.

The letters Ms Leutheusser-Schnarrenberger sent to Home Secretary Theresa May and Justice Secretary Chris Grayling urged them not to lose the principles of civil rights.

She wrote: "In our modern world, the new media provide the framework for a free exchange of opinions and information. Transparent governance is one of the most important prerequisites that a democratic state and the rule of law requires."

The BBC's Berlin correspondent Stephen Evans said the letters asked four main questions: On what legal basis the spying program was executed; whether general information is collected and does it need a specific reason or is a more general trawl; whether judges had approved the measures; what data was kept and was it on German citizens.

Image caption Leaked documents are said to reveal the amount of surveillance undertaken at GCHQ

Our correspondent said it is a real and potent issue in Germany because under the Nazi and Communist regimes spying on citizens was widespread and feared.

'Out-of-control snooping'

Liberty, meanwhile, believes its staff may have been targeted and wants security services watchdog the Investigatory Powers Tribunal to investigate.

The civil rights group said it believed its electronic communications and those of its staff "may have been unlawfully accessed by the likes of the Security Services and GCHQ".

It has issued a claim in the Investigatory Powers Tribunal contending that rights "under Article 8 of the Human Rights Act (the right to respect for one's private and family life, home and correspondence) have been breached".

Liberty's legal director James Welch said: "Those demanding the Snoopers' Charter seem to have been indulging in out-of-control snooping even without it - exploiting legal loopholes and help from Uncle Sam.

"No-one suggests a completely unpoliced internet but those in power cannot swap targeted investigations for endless monitoring of the entire globe."