As the United Kingdom’s answer to the NSA, Government Communications Headquarters (GCHQ) is London’s most powerful surveillance outfit. But recent revelations show that the agency’s top concern in 2005 was saving Harry Potter fans from spoilers.

JK Rowling’s series about the adventures of a boy wizard inspired one of the most rabid fan bases in the history of pop culture. If you thought Trekkies were out of this world, don’t get between a Potterhead and his disdain of Muggles.

What’s even more frightening about this legion of believers is that it has a spy agency at its back.

Speaking to Australia’s ABC Radio last week, Nigel Newton, an executive director at Bloomsbury Publishing, said that GCHQ contacted him in 2005 to say that it had discovered a leaked copy of the sixth Harry Potter book online.

"We fortunately had many allies. GCHQ rang me up and said, 'We’ve detected an early copy of this book on the internet,'" Newton said.

"If newspapers splashed 'Dumbledore dies' what pleasure is there going to be for a kid reading it? The enemies stood to ruin a great deal of pleasure for the world."

After convincing the agency to read a page of the leaked book, editors realized that it was fake.

Given the high level of expectations surrounding the sixth Harry Potter, "The Half-Blood Prince," Bloomsbury had help from a number of government officials.

"We also had judges and the police on our side," he said.

"It was completely mad and we were at the eye of the storm – I remember Jo Rowling phoning me once after she had delivered a new book saying, 'Please will you release the name of the title because I have people outside searching my trash can looking for bits of papers.'

"We had to go into a complete security lockdown because people were trying to steal the manuscript," he added.

It was an amusing chapter in GCHQ’s dark history. The spy agency’s mass surveillance network is typically used to monitor electronic communications. It also coordinates with the US National Security Agency, as revealed by the revelations of whistleblower Edward Snowden.

Ostensibly designed to prevent terrorist attacks, it seems highly unlikely that the fraudulent manuscript was an al-Qaeda plot. But at least something good came of the government’s unfettered sweeping of internet chatter, and copyrights were protected against the nefarious dark underworld of slithering snakes stealing stories.