Justice Helen Winkelmann found the warrants used did not adequately describe the offences to which they were related.
"Indeed they fell well short of that. They were general warrants, and as such, are invalid.''
Police said they were considering the judgement and are in discussions with Crown Law to determine what further action might be required.
They would not make any comment until that process was complete.
Justice Winkelmann's judgement released a short time ago found the warrants were far too wide in terms of the scope of the search and the amount of items they gave police authority to seize.
"These categories of items were defined in such a way that they would inevitably capture within them both relevant and irrelevant material. The police acted on this authorisation. The warrants could not authorise seizure of irrelevant material, and are therefore invalid.''
The court ordered an independent lawyer to review everything seized in the raid to determine what is relevant to the investigation and what is not.
Relevant material is to be released to US authorities and everything else is be returned to Dotcom "forthwith''.
The decision followed a hearing at the High Court in Auckland last month.
Kim Dotcom cried in court as his lawyer spoke of how he was ``ripped from his family'' during a dawn raid by police at the request of US authorities.
Dotcom, who was arrested alongside three associates, had argued for copies of the data on 135 computers and hard drives seized when police raided his $30 million home in Coatesville.
His lawyer Paul Davison QC said his client's rights had been "subverted'' after cloned copies of the hard drives were taken overseas by the FBI without his lawyers knowing.
Mr Davison told the court he wrote to Crown lawyers in February to ask that none of the data from Dotcom's computers leave New Zealand.
Mr Davison said Crown lawyers responded, saying: "The evidence is required in its original form to be sent to the US. That has not happened and will not happen without prior warning.''
He said he was told the FBI had been in New Zealand and made clones of the data on the computers and one copy would be made available to him.
Mr Davison said he had yet to receive that copy and was only told today that copies had been sent to the US.
"There has been no approval for removal.''
Mr Davison also said there had been an "excess of authority''.
"Here is an example of what I would submit at the most moderate was high-handed and at the worst misleading.''
He said the process was "off the rails'' and his client's rights had been "subverted''.
Dotcom wiped tears from his eyes and left court as Mr Davison said his client had been "ripped from his family'' and was now before the court asking for the legitimacy of the police actions to be looked at.
Justice Helen Winkelmann said she wanted an affidavit from Crown lawyers that would clarify whether or not the Solicitor General gave police permission to allow copies of the data on Dotcom's computers to be taken to the US.
Crown lawyer Mike Ruffin said the original police search warrant, signed by a district court judge, made it clear that the computers and hard drives would be taken to the US.
He said a proposal by Dotcom to have a judicial review of the information was "not practical because of the volume of the data''.
Mr Ruffin said copies of Dotcom's computers and hard drives could not be handed over because investigators were not yet able to determine what is relevant to the case and what is not.
Dotcom faces an extradition hearing in August which will determine whether or not he is to fly to the US to face charges including copyright infringement and wire fraud relating to the file-sharing website Megaupload.
Prosecutors allege a "mega conspiracy''; Dotcom denies the charges and says his website was legitimate.
Acknowledgements: - APNZ