The High Court has ruled a government spy agency's entire surveillance operation against the internet businessman Kim Dotcom and his associates was illegal.
The court decision from December last year has been released today.
The High Court found the Government Communications Security Bureau (GCSB) operation in 2011 fell outside the scope of its legislation at that time.
Kim Dotcom, Bram van der Kolk, Matthias Ortmann and Finn Batato are appealing against extradition to the United States to face charges of money laundering and copyright breaches.
The ruling said: "The circumstances of the interceptions of communications are Top Secret, and it has not proved possible to plead to the allegations the plaintiffs have made without revealing information which would jeopardise the national security of New Zealand.
"As a result the GCSB is deemed to have admitted the allegations in the statement of claim which relate to the manner in which the interceptions were effected."
Grant Illingworth, the lawyer representing Mr Ortmann and Mr van der Kolk, said the court ruling brought the whole operation into doubt.
It showed the extent of the GCSB's abuse of power, he said.
"The GCSB has now admitted that the unlawfulness was not just dependent upon residency issues, it went further.
"The reason it went further was because it didn't have authorisation to carry out the kind of surveillance that it was carrying out under the legislation, as it was at that time."
Mr Illingworth said it was unclear what the court ruling would mean for his clients' extradition appeal proceedings.
The government acknowledged in 2012 that its spying was illegal because it involved New Zealand permanent residents who should have been exempt from GCSB surveillance.