A judge has ordered the police to sift through all digital material taken illegally from Megaupload founder Kim Dotcom and to return anything irrelevant to their investigation - at their own cost.
Clones of hard-drives already sent to the United States must also be returned if they contain personal information, while any further copies must be destroyed, the court ruled.
Dotcom and his co-accused will then receive clones of devices deemed to be relevant to the case.
The judgement, made by chief High Court justice Helen Winkelmann today, says the seizure of devices without sorting them first was unlawful, and that the police have no right to keep irrelevant material.
Her orders follow a three-day remedies hearing in April, where Kim Dotcom's lawyers argued for the return of the material, while Crown lawyers said that was unnecessary.
It is the latest blow to the Crown and police following the January 2011 raid on Dotcom's Coatesville mansion.
The raid, requested by the FBI and carried out by the New Zealand police Special Tactics Group, was previously deemed illegal by the High Court last year, when Justice Helen Winkelmann ruled the warrants authorising it were too general.
Today, Winkelmann repeated that position, saying the defects in the search warrants "were such that the warrants were nullities", and that a miscarriage of justice did result.
She said, contrary to the police view, that she did not regard the deficiencies as minor or technical.
"The warrants could not authorise the permanent seizure of hard drives and digital materials against the possibility that they might contain relevant material, with no obligation to check them for relevance," Winkelmann wrote. "They could not authorise the shipping offshore of those hard drives with no check to see if they contained relevant material. Nor could they authorise keeping the plaintiffs out of their own information, including information irrelevant to the offences."
Winkelmann asked the police to inform the FBI of her decision.
Police are expected to complete the request at their own cost.