The British parliament has given a green light to new bulk surveillance powers for police and intelligence services that critics have denounced as the most far-reaching of any western democracy.

The Investigatory Powers Bill, which was passed on Thursday, would, among other measures, require websites to keep customers’ browsing history for up to a year and allow law enforcement agencies access to help with investigations.

Edward Snowden, former US National Security Agency contractor-turned-whistle-blower, said the powers “went further than many autocracies”.

“The UK has just legalised the most extreme surveillance in the history of western democracy,” he said on Twitter.

Will UK’s surveillance bill protect or harm public?

The bill, the first major update of British surveillance laws for 15 years, was passed by the House of Lords and now only needs rubber-stamping by Queen Elizabeth II.

Prime Minister Theresa May introduced the bill in March when she was still interior minister, describing it as “world-leading” legislation intended to reflect the change in online communications.

The bill gives legal footing to existing but murky powers such as the hacking of computers and mobile phones, while introducing new safeguards such as the need for a judge to authorise interception warrants.

But critics have dubbed it the “snooper’s charter” and say that, in authorising the blanket retention and access by authorities of records of emails, calls, texts and web activity, it breaches fundamental rights of privacy.

The UN’s special rapporteur on the right to privacy, Joe Cannataci, criticised the bill in his March 2016 report, saying “privacy-intrusive measures such as bulk surveillance and bulk hacking, as contemplated in the Investigatory Powers Bill, be outlawed rather than legitimised”.

‘Sad day for British liberty’

Rights organisation Liberty has challenged the legislation at the European Court of Justice, arguing that it is incompatible with human rights law, and a judgment is expected next year.

“The passage of the Snoopers’ Charter through parliament is a sad day for British liberty,” said Bella Sankey, the group’s policy director, in a statement on Thursday.

“Under the guise of counterterrorism, the state has achieved totalitarian-style surveillance powers – the most intrusive system of any democracy in human history. It has the ability to indiscriminately hack, intercept, record and monitor the communications and internet use of the entire population,” she said.

Jim Killock, executive director of digital campaigners Open Rights Group, warned that the impact of the legislation would reach beyond Britain.

“It is likely that other countries, including authoritarian regimes with poor human rights records, will use this law to justify their own intrusive surveillance powers,” he said.