New Zealand Prime Minister John Key has apologised to Kim Dotcom, after it was revealed that the Megaupload founder was illegally monitored under the assumption he was not a New Zealand citizen.

Kim Dotcom

A report earlier in the week from the Inspector-General of Intelligence and Security found that the Government Communications Security Bureau (GCSB) had monitored Dotcom and his associate Bram van der Kolk without checking their residency status.

It is illegal in New Zealand for citizens of the country to be spied upon by government agencies.

"Of course I apologise to Mr Dotcom, and I apologise to New Zealanders," Key said on 27 September.

In a press conference that followed his apology, Key said that New Zealanders had a right to be protected by the law and that the government had "failed to provide that protection to them."

The report found that the GSCB, which can only monitor foreign targets, had failed to check Dotcom's immigration status; if they had checked, then they would have found that the Megaupload founder holds a permanent resident's visa.

Key added: "The GCSB relied on information provided to it by the Organised and Financial Crime Agency. In my view, reliance on another party by GCSB is unacceptable.

"it is the GCSB's responsibility to act within the law, and it is hugely disappointing that in this case its actions fell outside the law. I am personally very disappointed that the agency failed to fully understand the workings of its own legislation."

A section of the report titled "Potential for confusion" explains how Dotcom and van der Kolk came to be monitored illegally:

As this matter went along what we discovered in the case of Dotcom and associated people was that resident status had been obtained on their behalf under the Immigration Act 1987 and carried forward under the later 2009 Act. It was understood incorrectly by the GCSB that a further step in the immigration process would have to be taken before Dotcom and associates had protection against interception of communications.

Kim Dotcom tweets

Dotcom tweeted after the apology was made: "Numerous unlawful acts against us by the NZ gov have been exposed. It's time for a full, transparent & independent inquiry," and addressed Key through Twitter, saying: "@JohnKeyPM, I accept your apology. Show your sincerity by supporting a full, transparent & independent inquiry into the entire Mega case."