Nick Clegg backed the decision to send top civil servant Sir Jeremy Heywood to urge The Guardian to destroy classified data received from Edward Snowden because it was “preferable” to taking legal action.

David Cameron instructed the Cabinet Secretary to contact The Guardian to spell out the serious consequences that could follow if it failed to hand over classified material from the NSA whistleblower and US fugitive.

Senior Whitehall sources confirmed to The Independent the Prime Minister’s central role in trying to limit revelations about UK and US intelligence operations contained in information the whistleblower received from the National Security Agency.

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

The Deputy Prime Minister was "keen to protect" the newspaper's freedom to publish while safeguarding national security, his spokesman said.

Mr Clegg agreed to the move on the understanding that destruction of the material would not impinge on the The Guardian's ability to publish articles, he added.

News of Mr Cameron’s direct intervention came as official Home Office and Scotland Yard accounts of the nine hour detention at Heathrow of the Brazilian partner of a Guardian investigative journalist were flatly contradicted by lawyers involved in the airport ordeal. According to the Metropolitan Police, David Miranda – whose partner Glenn Greenwald has led the reporting of stories linked to NSA material supplied by Mr Snowden – was offered legal representation during his questioning and a solicitor was in attendance.

The Home Office also claimed the detention was “legally and procedurally sound” and backed in full the Met’s account.

The Home Secretary, Theresa May, confirmed she had been briefed in advance of the detention, but insisted it was the police who had made the decision to stop and question Mr Miranda on his way through Heathrow from Berlin. These accounts do not match descriptions given by the Brazilian’s legal representative who eventually made his way to the transit area at Heathrow where Mr Miranda was being held.

Gwendolen Morgan, a solicitor at Bindmans who is representing Mr Miranda in challenging the legality of his detention, said: “It is incorrect that Mr Miranda was offered his choice of legal representation.

Inside Politics newsletter The latest news on Brexit, politics and beyond direct to your inbox Enter your email address Continue Continue Please enter an email address Email address is invalid Fill out this field Email address is invalid Email already exists. Log in to update your newsletter preferences Register with your social account or click here to log in I would like to receive updates on politics every morning by email Update newsletter preferences

“When we were told by The Guardian [of the detention], Gavin Kendall from our legal department was sent to Heathrow. “He was persistently blocked by officials for a long period from gaining access to the room where the questioning was taking place. The detention lasted nine hours, the legal limit of Schedule 7 of the Terrorism Act. Gavin finally gained access only during the last hour.”

Mr Kendall said that Mr Miranda’s request for a pen or pencil to write down details of the questions he was asked was repeatedly refused. He says he was also unclear about just who was questioning him.

The Home Office claim the questioning was “a Met-led operation” and involved six people. Scotland Yard stated it could not comment on who may or may not have been involved.

However security sources contacted by The Independent admit MI6 officials could have been involved. Bindmans said this account did not surprise them. “It was unclear throughout just who exactly was doing the questioning,” said Ms Morgan. Mr Miranda’s legal team in London are preparing an injunction which will demand a judicial review of the way the Schedule 7 anti-terrorism law was used against him.

His lawyers have also demanded the government explain at whose request, and for what purpose, the police seized “sensitive journalistic material” during his detention.

The UK’s independent reviewer of terrorism legislation, David Anderson QC, is scheduled to meet representatives from the Metropolitan police this week. Their discussions will centre on the “unusual” length of the detention period.

Downing Street’s insistence this week that the arrest of Mr Miranda was entirely an “operational matter” for Scotland Yard, does not sit easily with the Prime Minister’s hands-on involvement in Jeremy Heywood’s contact with Alan Rusbridger, the Guardian editor.

Government sources deny the Prime Minister was involved in “intimidation” of a Fleet Street editor. One source said “There was no injunction, no arrests. We just wanted to get these documents [in Snowden’s possession] back.”

It was suggested that inside Number 10, Sir Jeremy had been tasked with warning The Guardian of the “dangers of holding highly sensitive information on insecure servers [computers] that could damage Britain.”

It was denied that the Cabinet Secretary’s contact with Mr Rusbridger was “threatening”. The source suggested: “We had a mature conversation.”