Imagine this: A government, faced with public evidence that its foreign spy service was conducting domestic surveillance on its residents—instead of claiming the information is somehow secret and the people responsible are above the reach of the law—admits in public and in the courtroom that it violated basic rights.

That is exactly what happened last week in New Zealand in the controversial copyright infringement case surrounding Megaupload and its founder Kim Dotcom. At the same time in the US, the government is faced a very similar scenario: overwhelming evidence the National Security Agency (NSA) has illegally spied on Americans. However, not only has the government refused to admit any wrongdoing, it is actively trying to prevent courts from coming to any conclusions.

As EFF has previously reported, the case against Megaupload and Dotcom has been controversial from the start. Dotcom was arrested in New Zealand, while the U.S. government seized Megaupload’s property and executed search warrants on its leased servers based on claims of alleged copyright infringement the day after SOPA was declared dead by Congress. The military-style raid by the New Zealand police was criticized as over-excessive. And the loss of access to the servers has left many innocent users without access to their lawful data.

Then in June, the High Court in New Zealand ruled the warrants executed for the raid in New Zealand were invalid, making the resulting searches and seizures “illegal.” Now add that to the recent news that the Government Communications Security Bureau (GCSB)—New Zealand’s equivalent to the NSA—was illegally spying on Dotcom by monitoring all Internet traffic coming to and from his home. (The GCSB is legally barred some spying on residents of New Zealand, and a cursory check of government records shown Dotcom has been an official resident since 2010.)

New Zealand’s Prime Minister said he became aware of the illegal spying a few weeks ago and ordered an inquiry with the agency’s Inspector General. Immediately, the Prime Minister also publicly admitted that the GCSB “had acquired communications in some instances without statutory authority." He also filed a memorandum with the court in the Megaupload case in New Zealand, making the same admissions to the judge.

When the Inspector General came back just two days later and concluded the GCSB did indeed break the law, the Prime Minister personally apologized to Dotcom for violating his rights, adding "Frankly, I'm pretty appalled by what I've seen because these are basic errors."

While there are still unanswered questions in the GCSB case, New Zealand’s apologetic prime minister and vigilant judiciary stand in stark contrast to the current situation in the US, where overwhelming evidence has shown for years the National Security Agency has been warrantlessly wiretapping Americans on domestic soil since a few days after the September 11th terrorist attacks.

But instead of admitting to the spying and apologizing the public, the government has decided to stonewall and obfuscate the truth. In EFF’s long running lawsuit against the NSA—which will be heard in federal court in mid-December—the Obama administration has invoked the controversial ‘state secrets’ privilege, arguing even if all of the allegations are true, the court cannot decide the case because that process, even if done under secure court procedures, might reveal “national security” secrets.

Of course, the facts are indisputable and have been public for years. Government officials have admitted key details in Congressional testimony and on-the-record news interviews. Virtually every major news organization has reported on the NSA’s unconstitutional actions. EFF submitted evidence on behalf of AT&T whistleblower Mark Klein, which includes blueprints and photographs of the NSA’s secret room at AT&T San Francisco facility. Three former NSA employees, who worked closely on its computer systems leading up to 9/11, also have submitted declarations explaining how the agency has spied on Americans on domestic soil in violation of the law.

Further, instead of coming clean to the public about who has adversely affected by illegal spying, the NSA has refused to release even a general estimate on the number of Americans affected (somewhat audaciously invoking privacy as an excuse). Instead of vowing to prevent further violations of citizens’ constitutional rights, both the Bush and Obama administration have stonewalled any attempts to install transparency or privacy safeguards on the program through the FISA Amendments Act. And instead of supporting accountability, both Bush and Obama supported giving AT&T and the other telecom companies complete retroactive immunity for partnering with the NSA in violation of the law.

The New Zealand spy agencies clearly erred when they illegally spied on Dotcom, but the government’s response to the scandal has been commendable, and serves as a good example of how a government can prevent this type of spying from happening in the future. If only Americans had a government that would do the same.