There is no emergency that justifies rushing this urgent new "security" bill through parliament in the last few days before its summer break but it could nevertheless prove a major opportunity to bring the relentless rise of the surveillance state under democratic control.

The opportunity lies in the fact that in order to ensure the continued access of the police and security services to the personal internet and phone-use tracking data held by the telecoms companies, they have had to concede important privacy and civil liberty safeguards.

The aim of the emergency bill is to shore up powers signed off in 2009 that forced the internet and phone companies to keep for 12 months a wide range of billing data for email, text, internet and phone use including who is communicating with whom, when, from where and for how long. But they were struck down following a ruling from the European court of justice in April, which said that the existing system of data collection (as outlined in an EU directive on data retention) was too sweeping.

Most of the data is collected anyway by the companies for their business purposes, but the government paid them £65m to store it for 12 months. What is not on the immediate agenda is an attempt to bring back the so-called "snooper's charter" – the communications data bill that the Lib Dems refused to allow to progress – that would have extended the personal data collected to a wide range of social media use that is not currently collected by the companies for their business or billing purposes.

The detail of the "emergency" law when it is published will spell out exactly how far the government is prepared to go in complying with the 10 privacy principles set down by the European court of justice in its ruling to ensure that such blanket surveillance complies with a modern world that values individual privacy.

Those 10 principles cover issues such as the kind of data that is collected, the length of time it is held and restricting its use to tackling terrorism and serious crime and not motoring offences and other less serious matters.

Some of the immediate signs – such as the inclusion of a "sunset clause", with a termination date of December 2016 of the kind that has led to the demise of control orders – are promising.

But the three-party deal, struck by the Tories, Labour and particularly the Liberal Democrats, has also secured some longer-term gains that could prove crucial in unblocking the standoff between the security state and civil liberty and privacy campaigners since the Snowden disclosures revealed the industrial scale on which the intelligence services have been harvesting personal data from the web.

Those measures that could prove crucial in the longer term include:

• The "tip to toe" review of the foundation stone of the surveillance state – the 2000 Regulation of Investigatory Powers Act (Ripa) – to be completed by 2016, could prove particularly potent in ensuring that such state snooping in the name of counter-terrorism and serious crime is brought strictly under control.

• The US-style privacy and civil liberties board to ensure that civil liberties are a foundation stone of counter-terrorism legislation rather than an afterthought bolstered by annual transparency reports by the state agencies could prove the "alarm system" that the current oversight regime has failed to provide. It will effectively be a major expansion of the current one-man role of David Anderson, the counter-terror watchdog.

• The appointment of a senior diplomat to lead discussions with the US government and the internet companies to establish a new international agreement for sharing data across boundaries is also significant. It marks the first public official recognition that GCHQ and the NSA's secret mass harvesting of personal data from Google, Facebook and Twitter in their Prism and Tempora programmes need a new legal basis beyond obscure clauses in Ripa.

The prime minister says it has to be all done and dusted by 22 July, when the Commons rises, because the European court of justice ruling has triggered an emergency.

Number 10 warns that the internet and phone companies are already beginning to delete call records data vital to the police and security services. If there is such an emergency then it also existed the day after the ECJ issued its privacy ruling in April.

It was assumed then that ministers would just maintain a stalemate with the EU's highest court that could last for months or even years until a legal challenge could be organised. The Home Office asked the companies to carry on storing the data in the meantime.

Now, the only emergency is that a high court challenge backed by Liberty, the Open Rights Campaign and Privacy International that had been "parked" pending the European ruling is now active again.

This is a major piece of legislation that will shape how we live and work in the digital world. It may just "safeguard the existing position" – and these powers have been in use in Britain since 2009 – but it also provides an opportunity to hardwire in some civil liberties elements that were missing when Labour introduced them. Given Labour's "Big Brother" record on these matters when they were last in government, this may prove a rare liberal moment.