THE GCSB lost control of its surveillance technology and wasn't aware its systems continued spying on Kim Dotcom, according to new documents from the spy bureau.
It claimed that it turned off all surveillance systems targeting Dotcom and others but
found out more than a year later that surveillance continued without its knowledge.
The details in the documents have led Dotcom to state that there is now evidence the United States' National Security Agency was carrying out surveillance on him.
Dotcom, who should have been protected from GCSB surveillance as a New Zealand resident, said the GCSB did not know because its equipment was being used by the NSA, which was "directly involved".
"New Zealanders must know how much power a foreign state holds over their private information," he told the New Zealand Herald.
The admission from the Government Communications Security Bureau was made in High Court papers.
It aimed to explain why Dotcom and others charged in the FBI's Megaupload investigation were spied on for two months longer than previously admitted.
The surveillance against Dotcom led to the revelation the GCSB didn't understand its own law and had illegally spied on 88 people as a result.
If Dotcom were spied on by the NSA through GCSB systems, that number would likely be much higher because it was also following an inaccurate rendering of New Zealand law.
The GCSB has always said it stopped actively spying on Dotcom and his co-accused on January 20, 2012, but a recent High Court judgment revealed that the actual end of surveillance was March 22, 2012.
New High Court papers submitted by the Government in defence to a claim for damages over unlawful spying on Dotcom show the GCSB confirmed its active involvement ended on January 20, 2012, with the raid on Dotcom's mansion.
That was the date of the "Operation Debut" police raid on Dotcom's mansion in Coatesville, north of Auckland, which was to assist the FBI's multi-country takedown of the internet entrepreneur's Megaupload website.
The GCSB's role was to support police by monitoring the communications of Dotcom and others, passing on intelligence about where the targets would be and if they knew they were about to be arrested.
The court papers stated the spy bureau said it "detasked some selectors" on January 20, 2012, after the Friday dawn raid on the mansion by elite anti-terror police.
"Selectors" is the term used among Five Eyes countries to describe the search terms put into its global spying apparatus. Documents have previously showed Dotcom and his co-accused had email addresses, phone numbers, addresses and websites submitted to the GCSB as "selectors".
The GCSB also told the High Court the "majority of selectors" were removed on January 24, 2012, the Monday following the raid, and a further "small number of selectors" were removed on January 30, 2012.
"They say that all activity by GCSB staff relating to Operation Debut ceased by 30 January, 2012."
But it added: "Limited interception of some communications continued beyond the detasking date without the knowledge of GCSB staff."
The GCSB said it was unaware of continued access of Dotcom through its systems until legal action was filed over the unlawful spying.
The court case started in April 2013, after then-Cabinet Secretary Rebecca Kitteridge carried out a review into the GCSB which revealed 88 people had been unlawfully spied on.
There is no explanation in the court papers of how New Zealand's surveillance technology was used without the knowledge of the GCSB, which has the responsibility of running it.
The GCSB documents do contain an admission of NSA involvement, although it was not made outright.
In response to the accusation the GCSB had accessed NSA networks, the bureau refused to answer on national security grounds and acknowledged that under High Court rules that doing so would be seen by the court as an admission it had.
The same type of admission was made to the accusation the GCSB - and possibly the NSA - had accessed emails, phone and Skype communication, internet browsing histories and used phone or computer microphones to eavesdrop.
Experts quizzed by the Herald suggested it was either access to GCSB's systems by a Five Eyes power or that the GCSB had no idea over the surveillance processes it own systems were running.
And although audits of the system would be expected to show detailed reports of access, Kitteridge's view found the process was poor. She found "there is no internal audit function at all for many of the intelligence functions", that training was patchy and some audits simply weren't done.
Dotcom said the details showed some other party was using GCSB systems and he believed it would be the NSA.
"The US government has requested my extradition. The NSA is clearly the most interested party."
He said the alternative theory that the GCSB didn't realise what its systems collected would mean the bureau had no idea what it had done around a high-profile case which was subject to high-level scrutiny.
"The NSA has unrestricted access to GCSB surveillance systems. In fact most of the technology the GCSB uses was supplied by the NSA."
Dotcom said his legal team expected to take further action based on the revelation.
"If the GCSB was aiding and abetting the NSA to spy directly on New Zealanders then the seriousness of the situation has changed dramatically and a truly independent inquiry and a new criminal investigation will be unavoidable."
He said it raised questions about the spy laws which changed in 2013, giving the GCSB greater powers under clearer legislation.
There was a surge in public attention over the activities of the bureau including protest marches and community meetings before the law passed in Parliament with a single vote.
But it also raises questions about the legality. Five Eyes countries have some ability to access each other's systems but do so on the basis of a "signals intelligence directive" - a set of rules which spell out the law.
At the time of the unlawful surveillance on Dotcom, the New Zealand rules - called NZSID7 - were an inaccurate reflection of the law.
It would mean Dotcom would have been spied on unlawfully - as the GCSB has admitted has been the case - because he would have been protected if NZSID7 was accurate.
A spokeswoman for the GCSB said spying on Dotcom ended on February 16, 2012.
She said the March 22, 2012, date which emerged recently was in relation to "a plaintiff who has since settled with GCSB". Dotcom's co-accused, Finn Batato, Bram van der Kolk and Mathias Ortmann, along with family, were originally part of the claim for damages.
Further comment would not be made because the judgment was likely to be appealed, she said.
Also, she said: "We do not comment on what may or may not be operational."
A spokeswoman for Prime Minister Bill English said he would not comment because the case was before the courts.
"We also do not comment on operational matters relating to our security and intelligence agencies."
A similar "no comment" came from GCSB minister Chris Finlayson. The NSA has also yet to respond but pointed to public statements by its director that it respects the laws of partner countries.
Massey University's Dr Rhys Ball, a lecturer at the Centre for Defence and Security Studies, said he believed it more likely "selectors" believed to have been turned off had not actually been deactivated.
He said it seemed unlikely the NSA would have been able to carry out surveillance on GCSB systems without the GCSB knowing. "I wouldn't have thought you could do that."
Security expert Dr Paul Buchanan, who runs a consultancy called 36th Parallel Assessments, said if the remaining surveillance was "targeted" then it was carried out by the GCSB or one of the Five Eyes parties.
He questioned whether the GCSB had a side-operation providing support to NZ Security Intelligence Service inquiries into Dotcom.
Timeline - spying on Dotcom
: Police asked the GCSB for help spying on Kim Dotcom and others.
December 16: Spying operation starts.
January 20: Dotcom arrested. Spying operation ends.
January 24: Most "selectors" taken out of GCSB spying apparatus.
January 30: All GCSB work on Dotcom surveillance finished.
February 17: Question raised about legality of spying on Dotcom and two others.
February 27: GCSB legal director says a legal check has confirmed it was lawful.
March 22: Actual end of surveillance using GCSB assets.
August 9: High Court hearing hears disclosure that some other government agency "that worked for the government" was involved in Dotcom case.
August 16: Bill English as acting Prime Minister signs a Ministerial Certificate burying existence of the spying.
September 13: Prime Minister John Key is told the GCSB spied illegally and that the GCSB Ministerial Certificate is worthless. Later that month he makes it public, announcing inquiries and a review into the GCSB.
September 17: A GCSB member makes a sworn statement to the High Court saying surveillance ended on January 20.
March: Key's appointee Rebecca Kitteridge completes a review of the GCSB. When released, it is a scathing indictment on its processes.
April: Legal action is launched by Dotcom over the unlawful spying, making a financial claim for damages. The GCSB checks its records and discovers surveillance continued until March 22 2012.
July 14: A High Court judgment reveals publicly for the first time that the unlawful surveillance against Dotcom and others went until March 22.