British Prime Minister David Cameron has insisted his government is acting to keep people safe after it announced fast-track legislation to ensure police and security services can access mobile and internet data.

He said urgent measures were needed after a European Court of Justice ruling raised the prospect that communications companies could start deleting crucial material used to tackle terrorism and serious crime.

But he insisted the coalition was also toughening oversight and restricting the number of organisations that can get such information, preventing bodies such as Royal Mail from accessing it.

"Unless we act now companies will no longer retain the data about who contacted who, where and when," Mr Cameron said, "and we will no longer be able to use this information to bring criminals to justice and keep our country safe.

"Let me be clear, I am not talking about the content of those communications - just the fact that those communications took place - the so-called communications data. Who contacted who, when and where.

"This is at the heart of our entire criminal justice system. It is used in 95% or all serious organised crime cases handled by the CPS. It's been used in every major security service counter-terrorism investigation over the past decade.

"It is the foundation for prosecutions of paedophiles, drug dealers and fraudsters."

At a joint press conference, both Mr Cameron and his Liberal Democrat deputy Nick Clegg stressed that the Data Retention and Investigation Powers Bill would maintain the authorities' existing powers rather than add to them.

The six-clause bill is expected to be pushed through the Commons and the Lords next week after Labour signalled they would support it.

Mr Cameron said that alongside the measures on communications data, the government would also set out a clearer framework for intercepts - where the Home Secretary signs off warrants for accessing the content of phone calls and emails.

"Some companies are already saying they can no longer work with us unless UK law is clarified immediately," Mr Cameron said.

"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.

"As Prime Minister I know of examples where doing this has stopped a terrorist attack."

The proposals were discussed at an emergency cabinet meeting this morning, and Home Secretary Theresa May will make a statement to parliament later.

The Government has been forced to act as a result of a European Court of Justice ruling in April that a European Union data retention directive, which was implemented by the British Labour party in 2009, was invalid because it interferes with the fundamental right to respect for private life and personal data rules.

Police and security services had raised fears that without a legal underpinning and business need to keep information, companies would start deleting communications data that is often crucial for investigations into a range of serious crime including terrorism, child pornography and drugs trafficking.

The bill will mean firms can retain data for 12 months. It is due to go before the House of Commons on Tuesday, and be passed by both Houses by the end of the week.

The number of bodies able to approach communications companies to obtain data will be restricted, with some losing their access rights altogether and councils having to go through a single central authority.

A full review of the Regulation of Investigatory Powers Act will be held in the period before the legislation needs to be renewed, and the current Independent Reviewer of Terrorism Legislation will be beefed up to create a US-style Civil Liberties Oversight Board to scrutinise new government policy.

There will be annual reports on the use of surveillance powers to ensure more transparency.

A senior diplomat will also be appointed to lead talks with the US and the internet companies on forging an international agreement on sharing data between legal jurisdictions.