Whatever the results of last weekend’s summit between Barack Obama and Xi Jinping, its timing was magnificent.

The American president, one presumes, was taking his guest to task over China’s record of internet thievery – just as accounts emerged in his own country of massive cyber-intrusion and data mining by the government he runs. Moral of the story: everyone does it.

And now it transpires that Edward Snowden, the former CIA employee who has confessed to leaking details of the massive phone and internet data trawling by the US to The Washington Post and Guardian newspapers, is holed up in Hong Kong. Hong Kong now belongs to China. Will one great state pillager of electronic secrets have the ultimate say in whether the leaker is extradited back to face the justice of another great state cyber-intruder? Pots, kettles and the colour black have nothing on this.

Download the new Independent Premium app Sharing the full story, not just the headlines

And make no mistake, not only will the Americans want him back. Juridically, they have a pretty solid case, too. For one thing, Snowden has confessed. Second, the programs he revealed – the collection of telephone call records and the Prism internet surveillance system – were legal, at least according to the vague and extremely broad powers given to the US government under the Patriot Act, which became law just seven weeks after the 9/11 attacks.

That technically differentiates him from other great government leakers of recent history, like Daniel Ellsberg, of Pentagon Papers fame, and Mark Felt, the deputy FBI director in the early 1970s. Ellsberg brought to light systemic government deception over the Vietnam war; Felt helped reveal the series of breathtaking crimes by government that constitute the Watergate scandal.

Nonetheless, Snowden has surely performed a precious public service. Governments have a right to secrecy, but not an unfettered one. It is moreover the nature of the beast that if you give a government an inch, it will take a mile, especially if the sacred mission of guarding national security can be advanced. But who guards the guardians? There must be some policing of the beast. In the US, this is the task of Congress; but in matters of national security, Congress is itself heavily muzzled by secrecy. That’s where leakers and whistleblowers come in.

Civil libertarians are naturally appalled by government data mining. Other people (dare I suggest a majority) are not. What is undeniable, however, is that, thanks to a combination of the panic that followed 9/11 and the exponential advances since in information technology, data on ordinary individuals is being collected on an unprecedented scale, and not only in the US.

Happily, however, the very explosion of the surveillance state since 2001 contains its own checks and balances, the seeds not of its destruction, but of its exposure. These days, more than a million Americans have top secret government clearances. At the same time, the previous jealous hoarding of information by each of the plethora of US intelligence agencies – widely blamed for the failure to stop 9/11 – is no more.

“Need to know” has been replaced by “need to share”. But as the agencies, now augmented by armies of private security contractors, have pooled their knowledge, so has the likelihood grown of spectacular leaks. There has been a double multiplication; a multiplication of the number of people who, like Snowden, might become disgusted by the system of which they are part, and a multiplication of the data to which they have access.

Thus was a lowly army private and intelligence analyst named Bradley Manning able to lay his hands on huge quantities of secret State Department telegrams and pass them on to WikiLeaks. And now Edward Snowden. His exact career path is somewhat mysterious, but he never held a particularly senior job. Indeed, almost incredibly, it seems that he may not even have graduated from high school (but let it not be forgotten, Bill Gates dropped out of college, and look what happened to him).

And, in further defence of Snowden, how much damage has he actually done? Has he really made the country less safe? The US government of course argues that he has – that those trying to harm America have been handed priceless information about the tools that America has to defend itself. But any government would say that. You don’t spend uncounted billions of dollars on a secret state, the business of which is invading personal privacy, only to admit that the whole shady edifice wasn’t worth building in the first place.

In fact, however, serious terrorists must have assumed that the surveillance which is now public knowledge was in place all along. Those in the know here in Washington claim that some terrorist plots have been thwarted. But the details remain unknown, hidden under the veil of necessary secrecy. You may take these assurances at their word, depending on your trust in government, or you may not.

But don’t expect any great official illumination now. Naturally, there will be Congressional hearings. But these will be probably held by the respective intelligence Committees of the House and Senate – in other words, by bodies themselves complicit in the system. Their leaders are admitted into secrecy’s innermost temples, but only on condition that they, too, tell no one of the secrets vouchsafed to them.

That’s why, every now and then, you need whistleblowers and leakers. Governments have a right to secrets, but equally we who entrust so much to government have the right every now and then to a decent debate about it. We’ve got one now. Thanks to Edward Snowden.