WELLINGTON - (AFP) - Megaupload boss Kim Dotcom on Tuesday accused New Zealand police of kicking and punching him when they raided his Auckland mansion earlier this year to arrest him for alleged copyright piracy.

Dotcom told the Auckland High Court he tried to surrender peacefully to police during the raid in January, when about 70 armed police cooperating with a major US online piracy probe raided the mansion.

The German national, who is free on bail pending a US attempt to extradite him on charges including racketeering and fraud, said he fled to a "safe room" when he realized police were in his home and waited for them to find him.

"Then they were all over me, I had a punch to the face, I had boots kicking me down to the floor," he told the court, adding that one officer stood on his hand and another kneed him in the ribs.

"I was screaming and I was in pain," he said.

Dotcom, 38, was giving evidence at an appeal by prosecutors against a court ruling in June that the raid was illegal because the search warrant used by police was too broad to be considered reasonable.

Questioned by the prosecution about why there was no sign of violence in mugshots taken after his arrest, he said they were taken two hours after his arrest and bruises did not show up until the next day.

If upheld, the ruling that the search was illegal paves the way for Dotcom's legal team to argue that evidence seized during the raid be ruled inadmissible.

Megaupload and related file-sharing sites were closed after the raid in January, part of an investigation US prosecutors have described as the world's largest copyright action.

The FBI and US Justice Department allege Megaupload sites netted more than $175 million in criminal proceeds and cost copyright owners more than $500 million by offering pirated copies of movies, TV shows and other content.

Dotcom and three co-accused, who all deny any wrongdoing, face up to 20 years jail if convicted in a US court. They are due to appear at an extradition hearing in March next year.

Related: Anonymous Launches "Largest Attack Ever on Government and Music Industry Sites"