Police caused the illegal Dotcom spying scandal when they wrongly told a Government spy agency that Kim Dotcom and an associate were foreign nationals.
The Government Communications Security Bureau (GCSB) asked the Organised and Financial Crime Agency (OFCANZ) to confirm if internet tycoon Dotcom and his Dutch co-accused Bram Van Der Kolk were foreign nationals; and OFCANZ "gave that assurance'', court documents reveal.
But that advice was false. Both men and their families held New Zealand residency at the time of the raids, and the GCSB is not allowed to spy on New Zealanders and must focus on foreign intelligence.
The documents show OFCANZ asked the spy agency to obtain information relevant to the "location, awareness on the part of the wanted person of law enforcement interest in them, or any information indicating risk factors in effecting any arrest'' relating to Dotcom and Van der Kolk.
The spying on the pair began on December 16 last year and ended on January 20 this year but did not involve installing devices.
Other details of the GCSB operations relating to Dotcom cannot be released.
Prime Minister John Key would not comment on the assertion that it was the police who assured the GCSB that the interceptions were lawful, saying he wanted to wait for a final report from Inspector General Paul Neazor first.
That was expected by the end of the week.
However, he cast some doubt on it, saying "I strongly urge you not to jump to too many conclusions at this point.''
Mr Key said it was "useful'' that the court had put the memorandum into the public domain, but would not comment further, saying he wanted to see the final report by the Inspector General.
Labour leader David Shearer said it was incredible that the GCSB had not done its own checks on Dotcom's residency. "It's called the 'intelligence' agency.''
He said it was well known that Dotcom had residency, because he had celebrated it with a major fireworks display.
Finance Minister Bill English has denied claims that he signed an indemnity clause in the Dotcom case that would have opened up the taxpayer to pay for any damages which may arise in the Kim Dotcom case.
Mr English this morning said he needed to check his paperwork after claims by Mr Shearer that he [Mr English] had signed the indemnity clause.
As then acting Prime Minister, Mr English had signed off on a certificate for the court which confirmed the GCSB's role - but had not told Mr Key until last night. He said it was simply an administrative procedure.
"I didn't think I needed to inform the Prime Minister about that because there was a whole process run by the police and intelligence authorities around it.''
Mr Key confirmed this morning Mr English had signed a Ministerial Certificate.
That was in August after police were questioned about it in court by Dotcom's lawyers during last month's trial into the legality of the raids.
At the time, Mr Key was in the United States watching his son play baseball.
He said the ministerial certificate was information about whether the bureau had acted "because the court or someone might ask for that information, so it's essentially a suppression order''.
Mr Key said he found out about the unlawful actions of the GCSB on Monday when the agency advised him. It had discovered it had acted unlawfully five days prior to that. He learned about 5.30 yesterday afternoon that Mr English had signed the certificate.
Mr English said the matter was "an administrative procedure related to the court''.
"How that fits in I'm sure will be covered by the inquiry that the Prime Minister initiated.''
Mr English said he couldn't recall the details of the document, and he preferred not to comment on whether he should have told Mr Key earlier about the certificate or other aspects of the matter.
"It's all being dealt with by the inquiry, and it's a matter before the courts.''
Mr Key said it was not unusual that he was not told earlier of Mr English signing the certificate.
"You've got to remember at the point at which they signed that, the belief that was the bureau was operating lawfully.''
Meanwhile, Labour Leader David Shearer this morning said he understood the Government had signed "an indemnity order which will make us completely responsible for any suit that might arise from this''.
He understood that order had been signed by Finance Minister Bill English.
"If anything goes wrong and Kim Dotcom decides to sue, the US is not going to be held responsible only New Zealand.''
However Mr English this morning was refusing to comment on any indemnity.
"I've been involved in the processes and I prefer to make sure I go back over all the paperwork and the details before I make comment.''
The role of the GCSB in the Dotcom case was discovered in August when Mr Dotcom's lawyers questioned the police about a group of anonymous people who took part in a meeting in the leadup to the raids of Dotcom's mansion in January.
Intercepting the communications of Mr Dotcom, Bram van der Kolk and their families was unlawful because they were New Zealand residents, and the GCSB can only act on foreign nationals.
It is the job of the Security Intelligence Service to intercept communications of New Zealand residents and citizens.
Dotcom received his residency in December 2010 and the raid on the Coatesville mansion was in January this year.
Mr Key refused to say who had asked the GCSB to get involved or explain in more detail why its actions were unlawful, whether the FBI was directly involved, or what happened to the information that was gathered.
Mr Shearer said Mr Keys' comments about how little he knew about Dotcom were not credible.
"This man is living in his own electorate; half his Cabinet knew about it, his own agency has been spying on him [Dotcom] and an extradition order from the highest levels of the United States has come through. His foreign Minister must have known about that and yet John Key is completely in the dark.''By Claire Trevett @CTrevettNZH Email Claire, Adam Bennett Email Adam, Andrew Koubaridis @A_Koubaridis Email Andrew