MI5 has secretly been collecting vast amounts of data about UK phone calls to search for terrorist connections.
The programme has been running for 10 years under a law described as “vague” by the government’s terror watchdog.
It emerged as Home Secretary Theresa May unveiled a draft bill governing spying on communications by the authorities.
If it becomes law, the internet activity of everyone in Britain will be held for a year by service providers.
Police and intelligence officers will then be able to see the names of sites suspected criminals have visited, without a warrant.
Mrs May told MPs the proposed powers were needed to fight crime and terrorism but civil liberties campaigners warned it represented to a “breathtaking” attack on the internet security of everyone living in the UK.