One of New Zealand's intelligence agencies spied on Megaupload founder Kim Dotcom after it was given erroneous information on his immigration status, believing he was a foreign national.

A memorandum filed with Auckland's High Court by the Crown Law Office, released on Tuesday by the court, explained the mixup that caused New Zealand prime minister John Key to express "disappointment that unlawful acts had taken place."

Key called for an inquiry on Monday on why the Government Communications Security Bureau (GCSB), which handles signals intelligence, intercepted communications prior to the arrest of Dotcom and his Megaupload colleagues in January.

The 24 September memorandum said the New Zealand's Organised and Financial Crime Agency New Zealand (OFCANZ) sought the assistance of the GCSB in order to conduct simultaneous arrests.

The GCSB is allowed to give that kind of assistance, but only if the people targeted are foreign nationals, the memorandum said. Two of the four people arrested, Dotcom and Bram Van Der Kolk, are permanent residents of New Zealand. The GCSB's spying occurred between 16 December and 20 January 2012, the day Dotcom's mansion outside of Auckland was raided.

Finn Batato and Mathias Ortmann, also Megaupload defendants, were named in the memorandum but were not listed as having permanent resident status. Auckland's High Court is scheduled to address the latest surveillance issue on Wednesday.

The illegal surveillance issue adds to a list of missteps in the Megaupload case, including the use of overly broad search warrants to search Dotcom's house and the shipping of some evidence to the US.

Dotcom and his colleagues are sought by the US on charges of criminal copyright violations and fraud for running Megaupload, a file-sharing site that US prosecutors say rewarded users for trading files without permission of copyright holders. The US Department of Justice alleges Megaupload collected US$175 million in criminal proceeds.

Dotcom has also announced recently that a new version of Megaupload is being prepared for launch, complete with financial backers and servers ordered. 

Extradition hearings are expected to begin in March.