The controversial spy laws have been passed by Parliament by 61 votes to 59.

The laws were drafted in the wake of a succession of blunders by New Zealand's foreign intelligence agency, the Government Communications Security Bureau, which included illegally spying on German internet entrepreneur Kim Dotcom.

Earlier, Prime Minister John Key acknowledged new surveillance laws have "alarmed" some people but blames the Government's opponents for stoking their fears.

KEVIN STENT/Fairfax NZ OPPONENT: Labour leader David Shearer outlining his opposition to the bill.

Legislation giving the GCSB the power to spy on New Zealanders was debated in Parliament today ahead of being passed into law.

Key launched the debate with a defence of the bill, denying that it would give the GCSB more sweeping powers.



"Misinformation and conspiracy theories" had confused people about what the legislation would do, he said.



"That has some citizens agitated and alarmed which I regret," Key told Parliament.



But his regret would be greater if the bill was not passed.

Labour leader David Shearer accused the Government of ramming the legislation through over the concerns of New Zealanders.



The law change was an opportunity lost to lead the world by conducting a wide-ranging inquiry into the activities of New Zealand's intelligence agencies, he said.



There had been a loss of confidence in the intelligence and security apparatus.



An inquiry would have been a good starting point for restoring people's confidence.



"Instead, this bill is about simply getting across the line, a quick remedy to a political hangover," Shearer said.



Labour would replace the legislation after a wide-ranging inquiry into the security agencies, he said.



"We will involve New Zealanders every step of the way and we will replace this law with a world-leading one that is based on the findings of that comprehensive inquiry.



"Because the only way we will ever win people's trust back that has been so sadly lost right across this country is to get an enduring solution that works in the best interests of this country."

But Key said the legislation was essential.

"Over the past four and a half years that I have been prime minister, I have been briefed by intelligence agencies on many issues, some that have deeply concerned.

"If I could disclose some of the risks and threats from which our security services protect us, I think it would cut dead some of the more fanciful claims that I've heard lately from those who oppose this bill."

He rejected claims that the bill allowed "wholesale spying on New Zealanders" and said it simply made clear what it may and may not do.

He listed the first of the changes as allowing the GCSB to protect government organisations and the private sector from cyber-attack.



"The bill requires GCSB to get a warrant from the independent Commissioner of Security Warrants, and me, before it can intercept a New Zealander's communications.



"That warrant must be issued for a particular function, in this case cyber security. The clear intention of that function is to protect, not to spy.



He said the bill also allowed for conditions to be put on warrants and he intended to do that.



"I will not allow cyber security warrants in the first instance to give GCSB access to the content of New Zealanders' communications.

"There will be times where a serious cyber intrusion is detected against a New Zealander and the GCSB will then need to look at content - that's why the law allows that. But that should be the end point, not the starting point."



The second function was the collection of foreign intelligence, which had always been the biggest portion of GCSB's work.



The third function allowed the GCSB to assist police, NZSIS and NZ Defence Force.

It had been doing this for more than a decade, but the law allowing it to do so had been "ambiguous", Key said.

But he rejected that by writing into law what the GCSB had already been doing meant an extension of its powers.



"Instead, we will make it clear GCSB can assist only those three agencies, and only when they are able to show they have the lawful authority to undertake the surveillance themselves."

The legislation also allowed for a review of the intelligence agencies in 2015 and every five to seven years after that.

The GCSB would also be required to disclose how many times it had assisted other agencies and how many warrants and authorisations it had been issued.

Today in Parliament, National MP Mark Mitchell described how a military "sat phone" was stolen by al Qaeda operatives from a dead driver during an attack in Iraq.

Mitchell, a former police officer, worked in security in Iraq before being elected to Parliament.

"Before the account was cancelled there were over 200 calls made. The calls were spread around countries like Saudi Arabia, Yemen, the UK, some European countries, the United States and 14 calls were made to New Zealand," Mitchell told Parliament.

"Why would terrorists attacking and killing our allies in Iraq making calls to New Zealand?

"That is why we have agencies like the SIS and the GCSB so they can find out who and why."

Labour MP Grant Robertson accused Key of dismissing the likes of the Law Society, the Privacy Commissioner, Sir Geoffrey Palmer and others who had objected to the law.

"All of them dismissed by an arrogant out of hand, out of touch prime minister," Robertson told Parliament.

But Attorney General Chris Finlayson said and the "high and mighty, like Dame Anne Salmond" were wrong in their opposition to the bill. He labelled statements likening the GCSB bill to Nazi Germany "disgraceful".

The Law Society had also been "disappointing".

He said the problem was not the current legislation, but Labour's 2003 legislation, which provided conflicting explanations of GCSB's powers.

"The 2003 legislation was inadequate...it should never have been passed in the form it was."

Green Party co-leader Russel Norman said as the moment of truth approached on the bill MPs would have to decide how they felt about freedom.

"Are they going to vote for freedom and liberty or are they going to vote against it?"

Norman said the bill was a fundamental constraint on freedom.

"It restricts our freedom of expression; it reduces our freedom to live free from state surveillance and in that respect is a bill that reduces the freedom of New Zealanders. It is the moment of truth."



Maori Party co-leader Te Ururoa Flavell said the bill was a "nightmare" and he opposed it.