New Zealand police botched the paperwork in getting search warrants for the high-profile armed raid of internet tycoon Kim Dotcom's Coatesville mansion earlier this year, the chief High Court judge has ruled.
Justice Helen Winkelmann on Thursday ruled the search warrants were too broad and police exceeded their powers in seizing what they did.
She also said it was unlawful for copies of Dotcom's computer files to be taken by US authorities and New Zealand police should return copies to 38-year-old Dotcom.
FBI agents, who had sought help from New Zealand police, seized a massive 150 terabytes of data.
It is the latest court decision in favour of Dotcom, who has won bail and the return of some assets since the high-profile raid on his rented $30 million mansion north of Auckland in January.
Up to 70 officers, including the elite special tactics group and armed offenders squad supported by two helicopters, stormed the property.
Soon after his arrest, news reports were filled with images of the mansion and of police hauling away his pink Cadillac and Mercedes Benz.
The US says German-born Dotcom's MegaUpload website has cost Hollywood studios and other music, software and television copyright owners $500 million by facilitating internet piracy on a massive scale.
They are trying to extradite him to the US to face racketeering, copyright and money laundering charges and he faces up to 20 years in prison if convicted.
The month after the raid, police Assistant Commissioner Malcolm Burgess defended the heavy handedness of the raid.
He said that based on their intelligence there were firearms at the mansion and police decided it was the best way to get in safely.
However, New Zealand authorities are now silent on the latest court decision.
In a statement, police said they would not comment on the judge's decision until they had spoken to Crown Law about any further action.
Crown Law are also not commenting.
Dotcom's lawyers, in a statement, have said they are very happy with the decision and are considering their next step.
Dotcom himself, who has recently taken to Twitter and upped his media profile, was quiet about the decision.
He was attending a residents' association meeting on Thursday night but had asked it be closed to media.
However, his wife Mona, the mother of their five children, tweeted: "Amazing news today!!!"
Mrs Dotcom was pregnant with twins at the time of the raid.
MegaUpload's lawyers are expected to appear in a Virginia federal court on Friday (US time) to argue that the charges should be tossed out.
Dotcom's next court date in New Zealand is next Wednesday in the High Court at Auckland.