Plans for a Big Brother database holding records of every citizen's emails, internet visits and mobile phonecalls must include proper safeguards to protect the public from abuses of privacy, the head of the Crown Prosecution Service has warned.

Keir Starmer QC, the Director of Public Prosecutions, speaking publicly for the first time since taking up his post in November, said the Government, police and security agencies should only be allowed to collect and use that data where there was a clear "legitimate purpose" that justified the invasion of an individual's privacy.

Mr Starmer's comments yesterday will be leapt on by critics of the giant database plan who want the Government to water down the plans so that requests for access to information held on the new database will be made on a case-by-case basis. And many civil liberty groups believe the capacity for holding so much private information in one place is open to abuse and would lead to miscarriages of justice as well as breaches of privacy.

Download the new Independent Premium app Sharing the full story, not just the headlines

Mr Starmer said: "By its very nature criminal investigation touches on privacy. I think the right balance for any investigation or prosecution has got to have a legitimate purpose. Investigation of crime is a legitimate purpose." But Mr Starmer stressed, there must also be "effective safeguards" to act as a break on the state's invasion of the public's privacy.

His predecessor, Sir Ken Macdonald, described the database as an "unimaginable hell-house of personal private information" while the Government's independent reviewer of terrorism, Lord Carlile QC, attacked the raw plans as "awful". An expert in internet security said yesterday that the database, which could cost up to £12bn, would be a waste of money. Dr Richard Clayton, a security researcher at Cambridge University, told the BBC: "There's going to be a record of every single email ... That of course includes all the spam. There are much better things to do to spend our billions on than snooping on everybody in the country just on the off chance that they're a criminal."

Changes to EU law mean that phone companies and internet service providers must store communications data for 12 months, but the Government wants to divert that information to a government-controlled database. Under existing law, police and security agencies can request the information from companies.

Mr Starmer said the plans were at an "early stage" and that it was not clear what the "final model is going to be". But he cautioned: "It's the overall purpose of this exercise that's important."

A Home Office spokesman said: "Communications data is crucial for the police to be able to investigate and identify criminal suspects ... in increasingly complex criminal and terrorist investigations and will enhance our national security."

Big Brother: How much will they know?

The wholesale collection and storage of all our email, internet and mobile phone records would allow the Government to know more than it has ever known about how we live our daily lives.

By accessing mobile phone records and using GPS tracker technology it would be possible to discover where a phone-user is on any given day. Police or the security services would also be able to establish the length of each call as well as the number that was dialled. Messages to and from social networking sites like Facebook and MySpace could also be subject to covert surveillance, meaning the Government would know both where we are and who our friends or associates might be.

This information would be added to the records of all email traffic, allowing investigators to form a clearer picture of our social lives. This would include all emails, although not the content, from unsolicited sources. The picture would be completed by a trawl of our internet history which might lead the police to draw conclusions about our interests and shopping habits. At no time would we know we were being snooped on.