New Zealand passed legislation Wednesday allowing its main intelligence agency to spy on residents and citizens, despite opposition from rights groups, international technology giants and the legal fraternity.
The bill to expand the power of the Government Communications Security Bureau (GCSB) passed by 61 votes to 59 after impassioned debate, with Prime Minister John Key acknowledging the move had left some people "agitated and alarmed".
"This is not, and never will be, about wholesale spying on New Zealanders," Key told parliament.
"There are threats our government needs to protect New Zealanders from, those threats are real and ever-present and we underestimate them at our peril."
The push to change the law came after it emerged last year that the GCSB illegally spied on Internet tycoon Kim Dotcom before armed police raided his Auckland mansion as part of a US-led probe into online piracy.
At the time Key publicly apologised to Dotcom, who is a New Zealand resident and should have been off-limits to the GCSB under legislation preventing it from snooping on locals.
However, an official report found that Dotcom's case was only one of dozens in which the GCSB had overstepped its bounds.
Key then moved to change the law to let the GCSB spy on New Zealanders, arguing it needed to cooperate more closely with agencies such as the police and military in an increasingly complex cyber-security environment.
Dotcom has been one of the strongest opponents of the bill, saying it gives government spies legal access to New Zealanders' electronic communications, including mobile phone calls.
"This will be the birth of a surveillance state in New Zealand," he told a protest meeting in Auckland last weekend.
Tech giants such as Google, Facebook and Microsoft have also voiced concern about expanding the GCSB's surveillance powers.
"Blanket rules requiring data retention and accessibility are blunt tools, which have the potential to infringe on civil liberties and constrain economic growth," Facebook said in a submission to a parliamentary committee reviewing the bill.
New Zealand's Law Society, Human Rights Commission and Privacy Commission all made submissions raising concerns about the bill and calling for significant changes.
Explore further: When Facebook goes down it takes big chunks of the internet with it