A top-level inquiry is underway into what Prime Minister John Key says is illegal activity by the Government's spy agency in the Kim Dotcom case.
Mr Key says the Government Communications Security Bureau unlawfully intercepted communications.
Mr Dotcom, internet entrepreneur and co-founder of the file-sharing site Megaupload, is facing copyright, money laundering and fraud charges in the United States. He and three co-accused were arrested in Auckland in January and US authorities lodged papers seeking their extradition in March.
The Prime Minister says the Crown has filed a memorandum in the High Court in the Dotcom case, advising the court and affected parties the GCSB acted unlawfully while assisting police to locate certain individuals subject to arrest warrants issued in the case.
Mr Key says he is disappointed the unlawful acts took place and he expects the country's intelligence agencies to always operate within the law.
"The public is entitled to have full confidence that its security agencies will operate strictly within the letter of the law; and on this occasion that does not appear to have been the case."
He says his advice is that the illegal activity was a mistake, rather than a deliberate action.
Mr Key says he was informed about the matter by the director of the GCSB on 17 September after which he referred the bureau's actions to the Inspector-General of Intelligence and Security, Paul Neazor.
The Inspector-General is an independent statutory officer with the power to inquire into any matter related to a government intelligence agency's compliance with the law.
Mr Key says he has also asked the Inspector-General to recommend any measures he considers necessary to prevent the issue from happening again.
Warrants didn't have to be signed off - PM
The Prime Minister says he did not sign off any warrants for the covert surveillance of Mr Dotcom, as the GCSB does not need one for foreign nationals.
Mr Key says under the law governing the agency, the operation did not require a ministerial warrant but warrants are needed for the surveillance of New Zealand residents and citizens.
Mr Dotcom was granted conditional residence under the Investor Plus immigration category.
Mr Key says he will make as much of the Inspector-General's report public, without revealing any matters of national security.
The Crown Law Office has confirmed a hearing relating to the illegal activity will take place in the High Court in Auckland on Wednesday.
A spokesperson for the office says it won't release any information relating to the case before then.
"Concerned but not surprised' - lawyer
A lawyer for Kim Dotcom says he's deeply concerned about the revelations of illegal spying.
American Ira Rothken, who is currently in New Zealand, says he believes Mr Key has done the right thing, but he's not going to pre-judge the outcome of the inquiry.
Mr Rothken says it's not the kind of behaviour would he have expected in New Zealand which has a culture of protecting its citizens' rights.
But he says authorities have pursued the investigation very aggressively, so illegal spying is no surprise.
He told Radio New Zealand's Checkpoint he wants the inquiry to come out with appropriate remedies which stop it from happening again.
"We're hopeful that the inquiry will give us some precise results and that this sort of thing, domestic spying on residents, will never happen again."
Mr Rothken says at this stage he's not aware what material has been illegally intercepted.
Potential for expensive law suit - Labour
The Labour Party says the illegal activity will tarnish New Zealand's international reputation.
Labour says New Zealand is seen as one of the cleanest countries in the world, and this strikes at the heart of the way it will be viewed internationally.
It says the actions of the bureau leave New Zealand vulnerable to a potential multi-million-dollar law suit.
An investigative journalist says the Government's spy agency will have broken its own assurances, if it is found to have illegally spied on New Zealand residents.
Nicky Hager, who has written about the GCSB - including in the book Secret Power in 1996 - says the organisation has always given assurances it doesn't spy on New Zealanders.