When we last left off in the ongoing saga involving Kim Dotcom and the bumbling investigation into alleged crimes stemming from Megaupload, a New Zealand appeals court had ruled (PDF) nearly two weeks ago that Kim Dotcom has the right to sue the government of New Zealand for illegal surveillance.

As we reported last year, the NZ government admitted after the fact that Dotcom should not have been subjected to government surveillance due to his obtaining permanent resident status. New Zealand’s Government Communications Security Bureau (GCSB), analogous to the National Security Agency in the United States, is only allowed to engage in surveillance of foreigners.

According to new documents acquired by a New Zealand TV channel, the GCSB already had information as of December 16, 2011 (before the January 2012 raid) showing that Dotcom was a permanent resident of New Zealand and that the agency knew Dotcom should not have been targeted at all. Interestingly, the documents also show Dotcom’s government code name: “Billy Big Steps.”

On Tuesday, 3News reported that December 16, 2011 was the same day that spying on Dotcom began. By January 11, 2012, New Zealand police had Dotcom’s “entire immigration file.” The GCSB ended its spying on January 20 and carried out the raid the next day. By February 20, 2012, the GCSB knew that its spying was illegal—”but it took seven months until this was revealed to Dotcom, the prime minister, and the public,” the TV channel reported.

As a result of the disclosure, Hugh Wolfensohn, the then-deputy director (and acting director) of the GCSB, has now resigned. There are also questions as to whether or not Wolfensohn received a “golden handshake,” or some sort of notable compensation as a result of his sudden resignation. Wolfensohn was a 25-year veteran of the agency.

“This was a colossal cock-up inside the police and the GCSB,” Grant Robertson, a Labour deputy leader (in the political opposition) told the channel.

Prime Minister John Key also told 3News that there were big changes in the works with respect to the GCSB.

In an e-mail to Ars, Ira Rothken, Dotcom's attorney, said that his client "will seek a remedy not only to protect his rights but to protect the rights of all NZ residents against illegal spying."

"Given the repeated illegal acts and rights abuse by the government in this case from illegal search warrants to illegal spying to the illegal removal of data by the US, the case should be dismissed in the interests of justice," he added.