WELLINGTON, New Zealand—New Zealand's prime minister apologized to Kim Dotcom, founder of file-sharing website Megaupload.com, after an investigation found that the government intercepted his communications illegally.

"I apologize to Mr. Dotcom…we failed to provide that appropriate protection to him," Prime Minister John Key told reporters Thursday.

Related Video

Kim Dotcom, who once seemed like an underdog in the U.S.'s largest-ever criminal copyright case, has notched several legal wins. Photo: AP.

Mr. Key had released a report by Paul Neazor, the country's inspector-general of intelligence and security, into the "unlawful interception of communications" of certain people involved in Megaupload. The prime minister called the actions by the New Zealand Government Communications Security Bureau "hugely disappointing."

Mr. Dotcom and three co-defendants are in New Zealand fighting extradition to the U.S. for trial on charges including conspiracy to commit racketeering, conspiracy to commit copyright infringement and criminal copyright infringement.

The Government Communications Security Bureau is only allowed to intercept communications between foreign nationals. Mr. Neazor in his report said the bureau was unaware that Mr. Dotcom was a New Zealand resident and therefore in a protected category.

Mr. Key said the bureau had relied on information from police about the residency of the people involved and "did not check further," which he called unacceptable.

Government Communications Security Bureau Director Ian Fletcher said measures would be put in place to avoid a similar situation.

The illegal interception was the latest wrinkle in the case. In June a judge gave Mr. Dotcom access to evidence against him, along with access to his mansion and the right to travel freely within New Zealand. The U.S. appealed the decision, which is under review by the Court of Appeal. Later in June a judge ruled that warrants used to seize goods from properties associated with the case were invalid, though it wasn't clear how that would affect the case.

Mr. Dotcom, a German by birth, was arrested in January in Auckland, New Zealand. Megaupload Chief Marketing Officer Finn Batato, Chief Technical Officer Mathias Ortmann, and co-founder Bram van der Kolk also were arrested. Messrs. Batato and Ortmann are from Germany, while Mr. van der Kolk is a Dutch national. All four have denied the charges.

The U.S. Federal Bureau of Investigation shut down Mr. Dotcom's website, which the bureau said was used to pirate entertainment content valued at US$500 million.

Write to Rebecca Howard at rebecca.howard@wsj.com