"Sometimes, in the dangerous world in which we live, we need our security services to listen to someone's phone and read their emails to identify and disrupt a terrorist plot," Cameron told reporters. "As prime minister, I know of examples where doing this has stopped a terrorist attack."
Cameron stressed that the measures did not impose new obligations on data companies and insisted they would not authorize new intrusions on civil liberties.
"I want to be very clear that we are not introducing new powers or capabilities," he said.
Data companies have also expressed concern about the debate between privacy rights and security concerns and have called for a clearer legal framework in order to cooperate with law enforcement and intelligence agencies.
In a ground-breaking report last month, Vodafone revealed the extent to which governments seek out information from telecommunication providers. The report, which covered the 29 countries in which Vodafone operates, highlighted the thousands of requests that governments make for information.
Wiretapping phones and accessing call records for law-enforcement purposes is a decades-old practice even in the most open democracies. With backing from courts, police can also request cooperation from telecommunications companies as they pursue criminals.
But technology is transforming the arena.
The European court was concerned about the lack of restrictions on how, why and when the metadata could be used. It asked for a directive with more specificity on what type of crimes could be covered and how long the material would be retained.
The British legislation covers the collection of metadata, which make it possible for law enforcement authorities to identify subscribers and who they communicate with, as well as the time, place and frequency of communications. Such information doesn't include the content of any communications.
Cameron billed Thursday's measure as temporary, saying it will expire in 2016. The government says the stopgap measure will allow security and law enforcement authorities to keep functioning while giving Parliament time to create a more thoughtful law for a rapidly changing world.
The debate on privacy has intensified over the past year, following revelations from National Security Agency analyst Edward Snowden that the U.S. and other countries' intelligence agencies routinely and indiscriminately gathered and stored huge amounts of data from phone calls and Internet communications.
Those explosive revelations have also touched off confusion — with the public wondering if they face constant surveillance by government at all levels.
Shami Chakrabarti, director of the human rights organization Liberty, expressed doubt that there was really critical need for Cameron's measures now.
"We are told this is a pedophile and jihadi 'emergency', but the court judgment they seek to ignore was handed down over three months ago and this isn't snooping on suspects but on everyone," she said. "We are promised greater scrutiny and debate but not until 2016, as it seems that all three party leaders have done a deal in private. No privacy for us and no scrutiny for them."
Cameron insisted the measure aimed to put into British law now that such data must be retained — rather than waiting for new EU regulations to be drawn up among the bloc's 28 nations and risk losing the communications data between now and when the new EU law would take effect.