A previous attempt to introduce a similar law was abandoned by the former Labour government in 2006 in the face of fierce opposition.

However ministers believe it is essential that the police and security services have access to such communications data in order to tackle terrorism and protect the public.

Although GCHQ would not be able to access the content of such communications without a warrant, the legislation would enable it to trace people individuals or groups are in contact with, and how often and for how long they are in communication.

GCHQ will be able to watch emails Credit: Adam Peck/PA Wire

The Home Office tonight confirmed that ministers were intending to legislate "as soon as parliamentary time allows".

It is vital that police and security services are able to obtain communications data in certain circumstances to investigate serious crime and terrorism and to protect the public. We need to take action to maintain the continued availability of communications data as technology changes.

Communications data includes time, duration and dialling numbers of a phone call, or an email address. It does not include the content of any phone call or email and it is not the intention of Government to make changes to the existing legal basis for the interception of communications.

– Home Office statement

Government Communication Headquarters (GCHQ) on the west of Cheltenham Credit: Barry Batchelor/PA

Nick Pickles, director of the Big Brother Watch campaign group, said:

This is an unprecedented step that will see Britain adopt the same kind of surveillance seen in China and Iran.

This is an absolute attack on privacy online and it is far from clear this will actually improve public safety, while adding significant costs to internet businesses.

If this was such a serious security issue why has the Home Office not ensured these powers were in place before the Olympics?