Police and intelligence officers are to be handed the power to monitor people's messages online in what has been described as an "attack on the privacy" of vast numbers of Britons.

The Home Secretary, Theresa May, intends to introduce legislation in next month's Queen's Speech which would allow law-enforcement agencies to check on citizens using Facebook, Twitter, online gaming forums and the video-chat service Skype.

Regional police forces, MI5 and GCHQ, the Government's eavesdropping centre, would be given the right to know who speaks to whom "on demand" and in "real time".

Home Office officials said the new law would keep crime-fighting abreast of developments in instant communications – and that a warrant would still be required to view the content of messages.

But civil liberties groups expressed grave concern at the move. Nick Pickles, director of the Big Brother Watch campaign group, described it as "an unprecedented step that will see Britain adopt the same kind of surveillance as 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," he said. David Davis, the former Conservative shadow Home Secretary, said the state was unnecessarily extending its power to "snoop" on its citizens.

"It is not focusing on terrorists or on criminals," the MP said. "It is absolutely everybody. Historically, governments have been kept out of our private lives. They don't need this law to protect us. This is an unnecessary extension of the ability of the state to snoop on ordinary innocent people in vast numbers."

The former Labour Home Secretary Jacqui Smith abandoned plans to store information about every phone call, email and internet visit – labelled the "Big Brother database" – in 2009 after encountering strong opposition.

Ms May is confident of enacting the new law because it has the backing of the Liberal Democrats, normally strong supporters of civil liberties. Senior Liberal Democrat backbenchers are believed to have been briefed by their ministers on the move and are not expected to rebel in any parliamentary vote. A senior adviser to Nick Clegg said he had been persuaded of the merits of extending the police and security service powers but insisted they would be "carefully looking at the detail". "The law is not keeping pace with the technology and our national security is being eroded on a daily basis," the adviser said.

Confirming the legislation would be introduced "as soon as parliamentary time allows", the Home Office said: "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."

According to The Sunday Times, which broke the story, the Internet Service Provider's Association, which represents communications firms, was unhappy with the proposal when it was briefed by the Government last month. A senior industry official told the paper: "The network operators are going to be asked to put probes in the network and they are upset about the idea... it's expensive, it's intrusive to your customers, it's difficult to see it's going to work and it's going to be a nightmare to run legally."

Google and BT declined to comment. A spokesman for Microsoft told The Independent: "We comply with legislation in all the countries in which we operate. This is a proposal and we have not had the opportunity to review it in depth."

Shami Chakrabarti, director of Liberty, said the Conservatives and the Liberal Democrats had resisted greater surveillance powers when in opposition. "This is more ambitious than anything that has been done before," she told Sky News's Dermot Murnaghan. "The Coalition bound itself together in the language of civil liberties. Do they still mean it?"

SECURITY THEN AND NOW

June 2009: "Today we are in danger of living in a control state. Every month over 1,000 surveillance operations are carried out. The tentacles of the state can even rifle through your bins for juicy information." David Cameron