Along with trying to track cyber-criminals and terrorists, the U.K. government’s surveillance arm also put its extensive capabilities into making sure that the plot of one of JK Rowling’s "Harry Potter" books didn’t leak online.

Back in 2005, at the height of Potter-mania, Rowling and publisher Bloomsbury Publishing were preparing for the launch of the penultimate novel in the hugely popular — and lucrative — series, “Harry Potter And The Half Blood Prince.”

That was when Bloomsbury’s Nigel Newton got a call from Government Communications Headquarters, better known as GCHQ, which is the U.K. equivalent of the National Security Agency (NSA). The agent who contacted Newton said the agency had tracked someone online trying to sell what they claimed was a stolen copy of the "Half Blood Prince" manuscript.

Bloomsbury had ratcheted up security as the book was being published, hiring extra security guards and even guard dogs at the printing press, to counteract such a theft. GCHQ said the manuscript was being offered for sale online but it turned out to be a false alarm.

“We fortunately had many allies,” Newton told Australian radio station ABC. “GCHQ rang me up and said: ‘We’ve detected an early copy of this book on the internet.’ I got them to read a page to our editor and she said, ‘No, that’s a fake’.”

At the time, interest in the book was reaching fever pitch after Rowling indicated that a major character would be killed off in the book. “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.”

While GCHQ has not confirmed its part in the events, it did offer this cryptic message to the Sunday Times: “We don’t comment on our defense against the dark arts.”