The Government Communications Security Bureau and Related Legislation Amendment Bill has passed at its third reading.
Prime Minister and Minister Responsible for GCSB John Key welcomed the passing of the legislation.
"Despite ill-informed claims to the contrary, nothing in this legislation allows for wholesale spying on New Zealanders. It actually tightens, not widens, the existing regime,'' Mr Key said.
"This essential legislation makes it clear what the GCSB may and may not do, and fixes an Act passed under the Labour Government a decade ago, which was not, and probably never was, fit for purpose.
"It clarifies the GCSB's legal framework and substantially increases oversight of the country's intelligence agencies, which will go some way to rebuilding public confidence in the GCSB,'' Mr Key said.
The legislation passed today makes the GCSB's three functions clear, he said. ``These are:
Information assurance and cyber security;
Foreign intelligence, and;
Assisting other agencies.''
The Green Party said a fundamental constraint on freedom had become law.
"The National Government, along with Peter Dunne and John Banks, have signed away significant freedoms of New Zealanders by passing the Government Communications and Security Bureau (GCSB) legislation tonight,'' Greens' Co-leader Dr Russel Norman said.
"This legislation ... restricts our freedom of expression and our right to live without surveillance,'' he said.
Earlier today, during the third and final reading of the bill, Mr Key said if he could disclose some of the briefings he had had about risks to New Zealand it would "cut dead'' some of the opposition to the GCSB bill, but he could not divulge them.
He said he regretted that many citizens had become agitated and alarmed about the bill, but he would be more regretful if the bill's changes were not passed.
"The bill is being passed right now because it is needed right now.
"Others may play politics with the security and lives of New Zealanders, but I cannot and I do not and I will not.''
He said the bill "isn't a revolution in the way New Zealand conducts its intelligence operations.''
It made it clear what the GCSB could and could not do.
Mr Key said nothing in the bill allowed for wholesale surveillance of New Zealanders.
He repeated the statements he made to the Herald last week that approving interception warrants of New Zealanders under the cyber security function would be a two-step process, and that a warrant to look at content would be with the consent of the New Zealander unless there was a good reason not to seek consent.
It was Mr Key's first speech in Parliament on the bill, with previous debates having been handled by Justice Minister Judith Collins and Attorney-General Chris Finlayson.
Under the bill, the GCSB will have three functions. It will retain its traditional function of collecting foreign intelligence, and it is not allowed to spy on New Zealanders under that function, either under the current law or the new law.
Another function will be to assist the SIS, the police and Defence in conducting duly warranted interceptions of New Zealanders. It has been doing this already under doubtful legal authority, because while the current law says the GCSB can help such agencies in specific ways, it explicitly says it cannot spy on New Zealanders.
A further expansion of powers comes under the GCSB's cyber-security function. Until now its job has been to protect only Government communications from attack, but it will be extended to private-sector cyber systems if they are important enough to New Zealand.
In his speech, Mr Key also reiterated the position on metadata - that it would be treated the same in the bill as communications, which means that before a New Zealander's metadata can be collected, it will require a warrant to be signed by the Prime Minister and the Commissioner of Security Warrants.
Labour Leader David Shearer said a Labour-led government would hold an inquiry in order to create a world class intelligence service.
Labour Deputy Leader Grant Robertson said Mr Key's claim that the bill did not expand the GCSB's function was "fundamentally wrong.'' There were clearly new powers under the cyber security function, he said.
Greens' Co-leader Russel Norman said many people died last century fighting for freedoms "and we, here today, are fighting for those basic principles.''
He said it was hard to have a debate about protecting freedom in the abstract, and that was made harder with the Prime Minister "screaming hysterically about al Qaeda.''
Attorney-General Chris Finlayson attacked several critics of the bill including Rodney Harrison, QC, who presented the Law Society's submission on the bill, former Prime Minister Sir Geoffrey Palmer, former director of the GCSB Sir Bruce Ferguson, and historian and academic Dame Anne Salmond.
He told Parliament the bill hadn't been rushed through, but perhaps it had not been long enough for Mr Harrison to come to grips with it. He said much of difficulties that the bill addressed had occurred under Sir Bruce's watch despite him trying to reinvent himself as a commentator.
Mr Finlayson said Sir Geoffrey had allowed the GCSB to operate without any legislation at all while he had been Prime Minister, and he described Dame Anne's attacks as "shrill and unprofessional.''
The real problem had been with the passage of the 2003 legislation which should never have been passed, he said.
Yesterday Mr Key said he and GCSB director Ian Fletcher would resign if he found that the GCSB had engaged in mass surveillance because it would be unlawful.
Under current act, the GCSB:
• Gathers intelligence by spying on foreigners.
• Cannot spy on New Zealanders to gather intelligence.
• Protects Government communications from cyber attack.
• May help other domestic agencies such as SIS, Police and Defence and other entities in an unspecified manner.
Under new act, the GCSB:
• Protects Government communications and important private sector systems from cyber attack.
• Can spy on New Zealanders' communications content under cyber security, though John Key says it will be rare and on a second warrant only.
• Can help specifically the SIS, Police and Defence, to spy on New Zealanders if the other agencies are authorised under warrant or statute.
• Still cannot spy on New Zealanders to gather foreign intelligence.
The word metadata (eg data logs rather than content) is not mentioned in the current act or the proposed act but the Attorney-General has stated in the Second Reading that the Government regards metadata as communications _ and therefore a warrant will be required by the GCSB to access New Zealanders' metadata.