Police have launched a criminal investigation after examining material from the partner of a Guardian journalist who was held under UK anti-terror laws.
David Miranda was detained at Heathrow for nine hours on Sunday and officers have seized tens of thousands of pages of information from his electronic equipment.
The Metropolitan Police said it included "highly sensitive" material which could put the public at risk if disclosed.
Mr Miranda had nine items, including his laptop, mobile phone, memory cards and DVDs, confiscated during the detention, according to his lawyers.
The High Court was told about the criminal investigation as it heard an application by him for an injunction preventing police and the Government from accessing his data.
Judges adjourned his application for seven days until August 30.
They ordered the seized data could only be examined in the meantime for national security purposes and the protection of the public.
The judges said this included investigating whether Mr Miranda himself was involved in the commission, preparation or instigation of acts of terrorism.
The Brazilian partner of reporter Glenn Greenwald, who has worked with US whistleblower Edward Snowden, was held at Heathrow as he tried to change planes in what he claims was a misuse of Schedule 7 of the Terrorism Act 2000 and breach of his human rights.
Jonathan Laidlaw QC, for the Met Police, told the court "tens of thousands of pages of material" had been taken from his electronic equipment since the detention.
He said: "That which has been inspected contains in the view of the police highly sensitive material disclosure of which would be gravely injurious to public safety.
"Thus the police have now initiated a criminal investigation."
He also told the court: "I am not proposing to say anything else which might alert potential defendants here or abroad to the nature and the ambit of the criminal investigation which has now been started."
Scotland Yard was unable to provide any more details on the police investigation when contacted by Sky News Online.
Police insist the detention was "legally and procedurally sound" but that is disputed by Mr Miranda's lawyers and has been questioned by a former Lord Chancellor, Lord Falconer.
In court, Matthew Ryder QC for Mr Miranda said he was questioned and his property seized "under threat of criminal prosecution in a coercive use of Schedule 7 which was unlawful".
Home Secretary Theresa May's lawyer Steven Kovats said the material taken included information which could "endanger national security of the UK and put lives at risk" if disclosed.
He insisted it was "necessary for the national security of the UK" for the Government and its agencies to be given free access to the data "without delay".
A Home Office spokesman said: "We are pleased the court has agreed that the police can examine the material as part of their criminal investigation in so far as it falls within the purposes of the original Schedule 7 examination and in order to protect national security."
Outside court, Mr Miranda's solicitor Gwendolen Morgan said the Government now had seven days to "prove there is a genuine threat to national security".
Asked what she knew of the police investigation, she added: "Very little. We don't know any basis for that."
Following a row about civil liberties and the freedom of the press, the case is already being looked into by David Anderson, the independent reviewer of anti-terror laws.
He will examine the use of anti-terror powers to detain Mr Miranda and wants to to establish if the power - contained in Section 7 of the Terrorism Act 2000 - was "lawfully, appropriately and humanely used".
Downing Street was aware of the planned detention but insists there was no political involvement in the decision - which was also communicated to the White House.
A poll found that while most voters (66%) backed the need for the powers used to detain Mr Miranda, only 37% thought it was right to use them on the grounds he might have data useful to terrorists.
The survey by YouGov showed the public thought it unreasonable to threaten him with jail for not disclosing passwords, by 47% to 38%, and half said his computer and phone should have been handed back when he was released.