A High Court judge has ruled that police search warrants used to seize property from Kim Dotcom were ''invalid".
Justice Helen Winkelmann found the warrants used did not properly describe the offences to which they were related.
She said that police, without a valid warrant, were trespassing and exceeded what they were lawfully authorised to do.
Dotcom had earlier questioned the legality of the search warrants police used to raid his mansion in January.
His lawyer Paul Davison QC told the Auckland High Court last month police carried out a sweep of electronic equipment.
Davison alleged 135 data storage devices were taken during the police raid.
Justice Winkelmann has also ruled it was unlawful for copies of Dotcom's computer data to be taken offshore.
FBI agents had been accused of underhanded behaviour by Dotcom's lawyers in the High Court after they secretly copied data from his computers and took it overseas.
Megaupload's lawyer, Willie Akel, last month told Auckland High Court that two FBI analysts flew to New Zealand on March 20 and reviewed seven hard-drives of information.
The analysts cloned the computers in Manukau.
Justice Winkelmann ordered that no more items taken in the raids could be removed from New Zealand and instructed the Attorney-General to return clones of the hard drives held by New Zealand police.
A police statement said they were considering the judgement and are in discussions with Crown Law to determine what further action might be required.
Dotcom, 38, is on bail awaiting an extradition hearing.
US authorities say he and his three co-accused - Mathias Ortmann, Fin Batato and Bram van der Kolk - used Megaupload and its affiliated sites to knowingly make money from pirated movies and games.
Dotcom is charged with multiple copyright offences.
- Auckland Now
Are you happy with the council rates revaluation on your home?