Communication companies had been required to retain data for 12 months under a 2006 European Union directive but this was thrown out in April by the European Court of Justice on the grounds that it infringed human rights.
Britain's coalition government said the scrapping of that directive could deprive police and intelligence agencies of access to information about who customers contacted by phone, text or email, and where and when.
Prime Minister David Cameron said it was vital these powers were not compromised at a time of growing concern over Britons travelling to Iraq and Syria to join militant Islamist groups.
Those concerns prompted the government to take the unusual step of announcing fast-track legislation which, under a deal brokered behind closed doors between Britain's three major political parties, could become law as soon as next week.
"This is at the heart of our entire criminal justice system," Cameron told a news conference. "It is used in 95 percent of all serious organised crime cases ... It has been used in every major security service counter-terrorism investigation over the last decade and it is the foundation of prosecution of paedophiles, drug dealers and fraudsters."
In an effort to deflect criticism that collecting communications data flouted civil liberties, Cameron stressed the emergency law would not grant new powers and would only enshrine existing capabilities in law.
He said the new legislation would also clarify the grounds under which authorities could request service providers provide the content of calls, emails and text messages, even if the companies holding that data were based overseas.
"There is now a real risk that legal uncertainty will reduce companies' willingness to comply with UK law, even where they would wish to support us," the Conservative prime minister said. "Some companies are already saying they can no longer work with us unless UK law is clarified immediately."
The biggest Internet Service Providers in Britain are BT, BSkyB, TalkTalk and Virgin Media. The four main mobile providers who would be affected include EE, O2, Vodafone and Three.
Britain is the first EU country to seek to rewrite its law to continue data retention since the European court decision, and the government said it was in close contact with other European states on the issue.
Denmark said in June that it would no longer enforce part of a local law that requires "session logging" - or data retention - by telecom operators while in Sweden, telecom operators simply stopped collecting the data.
Britain's new measures come in the wake of revelations by former U.S. intelligence contractor Edward Snowden about British spying on private communications, and privacy campaigners said they were worried about the implications of the legislation.
"We need to get back to a point where the police monitor people who are actually suspected of wrongdoing and rather than wasting millions every year requiring data to be stored on an indiscriminate basis," Emma Carr, acting director of Big Brother Watch, said in a statement.
The government said the law would establish a Privacy and Civil Liberties Oversight Board, based on a U.S. model, to ensure civil liberties were properly taken into account.
It also said the number of bodies that could approach telecoms and Internet firms for data would be restricted, and there would be an annual transparency report to make information more widely available on surveillance powers used by the state.
The emergency legislation will include a termination clause meaning it will expire in 2016, forcing lawmakers to look at the measures in detail again before then.
Last year, the government failed to bring in a Communications Data bill, which critics dubbed a "snoopers charter" and would have secured the West's most far-reaching surveillance powers in the face of widespread opposition.
Senior police and security chiefs had argued that unless they were given new powers to monitor online activities, militants and criminals would exploit new forms of communication technology such as Facebook and Skype.
But the centre-left Liberal Democrats, the junior partner in Cameron's government, blocked those plans saying they were not proportionate or workable.
© Thomson Reuters 2014