David Cameron ordered Britain's most senior civil servant to contact the Guardian over classified information leaked by the whistle-blower Edward Snowden, it has emerged.
Whitehall sources confirmed Sir Jeremy Heywood approached the newspaper.
It came after the Guardian published details about secret US and British surveillance programmes.
Editor Alan Rusbridger said it was forced to destroy the computer hard drives storing the information in July.
Mr Rusbridger said his conversations with the government prior to that happening on 20 July had been with "a very senior official claiming to represent the views of the prime minister".
But he did not say exactly who he had spoken to.
Meanwhile, the partner of a Guardian journalist held for nine hours at Heathrow airport under anti-terror laws on Sunday has described his "feeling of invasion" after being forced to divulge email and social media account passwords.
David Miranda told the BBC his interrogators threatened that he could go to prison if he did not co-operate.
'Threat to UK'
BBC political correspondent Chris Mason said these reports were accurate.
Whitehall sources emphasised it would have been a "total abdication of their responsibilities" not to talk to the Guardian.
The government feared that if secret data held by the newspaper fell into what it called "the wrong hands" it could have been a threat to the UK, the sources added.
The conversations between Whitehall and the Guardian took place with the explicit approval of Mr Cameron, Deputy Prime Minister Nick Clegg and Foreign Secretary William Hague.
A spokesman said the deputy prime minister had thought it was "reasonable" for Sir Jeremy "to request that the Guardian destroyed data that would represent a serious threat to national security if it was to fall into the wrong hands".
He continued: "The deputy prime minister felt this was a preferable approach to taking legal action. He was keen to protect the Guardian's freedom to publish, while taking the necessary steps to safeguard security.
"It was agreed on the understanding that the purpose of the destruction of the material would not impinge on the Guardian's ability to publish articles about the issue, but would help as a precautionary measure to protect lives and security."
Mr Hague said it was a "very simple matter" of the government having a duty to retrieve classified information to stop it ending up with the wrong people.
Home Secretary Theresa May said it was not surprising that a senior government official should be involved in discussions with the Guardian about sensitive information.
Following the conversations with Whitehall, Mr Rusbridger agreed to what he has called one of the most bizarre incidents in the newspaper's history.
Two GCHQ security experts oversaw the destruction in a basement of computer files containing information from the US National Security Agency leaked by Mr Snowden.
Mr Rusbridger said: "We were quite clear we were not going to hand this material back to the British government so we destroyed it ourselves under advice from a couple of GCHQ intelligence experts, who told us which bits of the hard drive to smash up, in what way."
The editor said he believed handing the hard drives to the government would have been a betrayal of the newspaper's source.
It is understood the files had already been copied and the Guardian is expected to continue pursuing the Snowden story, but from the US.
Sir Malcolm Rifkind, chairman of the Intelligence and Security Committee, told Radio 4's Today programme: "Neither Mr Snowden nor the editor of the Guardian - or the editor of any other newspaper - is in a position to necessarily judge whether the release of top-secret information may have a significant relevance in the battle against terrorism."
He went on: "Sometimes you might genuinely think you can release a document and it's not going to be of any assistance to a terrorist when in fact you might be wrong - and that's simply a question of your inability to judge if you are a newspaper editor or a journalist as opposed to somebody involved in the intelligence work that has to be done."
Former National Security Agency contractor Mr Snowden has been granted asylum in Russia despite requests from the US that he be returned.
Asked about the Independent's story, a spokeswoman for the Guardian told the BBC: "We're not going to comment on this."
Meanwhile, it has emerged that Mr Miranda - the partner of Guardian journalist Glenn Greenwald who has covered stories based on leaks by Mr Snowden - is launching legal action over his detainment at Heathrow airport.
He has said he wants his confiscated electronic equipment returned and assurances that his private data will not be distributed on to other parties.