Police in London have said "highly sensitive" material was seized from the partner of journalist Glenn Greenwald, who has led coverage of US whistleblower Edward Snowden's leaks.
They said if it had been disclosed it could have put lives at risk.
David Miranda was detained for nine hours at London's Heathrow Airport on Sunday when the material was taken from him.
Police said an initial examination of the information had prompted a criminal investigation by counter-terrorism officers.
Using anti-terrorism powers, British police detained Mr Miranda, a Brazilian citizen, at the airport last weekend.
Mr Miranda, who had been ferrying documents between Mr Greenwald and a Berlin-based journalist contact of Mr Snowden's, was released without charge minus his laptop, phone, a computer hard drive and memory sticks.
At a hearing in London's High Court over Mr Miranda's lawyers attempt to prevent British authorities from looking at the tens of thousands of documents on the devices, a lawyer for London's Metropolitan Police said some contained dangerous information.
"That which has been inspected contains, in view of police, highly sensitive material the disclosure of which would be gravely injurious to public safety and thus the police have initiated a criminal investigation," Jonathan Laidlaw said.
The police declined immediate comment on what the criminal investigation was about.
Mr Miranda's lawyer, Gwendolen Morgan, told reporters that she knew very little about the investigation or what the basis for it was.
Two High Court judges, Jack Beatson and Kenneth Parker, ruled that the British authorities could continue to look at the information from Mr Miranda for the defence of national security and to investigate any possible links to terrorism.
The judges gave British authorities until 30 August to sift through the documents.
Mr Miranda's lawyer has also started legal action to ask judges to rule that his detention was illegal.
The criminal investigation is the latest twist in a surveillance scandal that has pitted US President Barack Obama against Russia.
It has also prompted British Prime Minister David Cameron's advisers to demand the return of secrets from the Guardian newspaper.
Mr Greenwald, who is based in Brazil and writes for the Guardian, has published articles based on documents leaked by Mr Snowden, the former US National Security Agency contractor who faces criminal charges in the US.
British security officials say the Snowden leaks, which showed the scale of US and British eavesdropping on everything from phone calls and emails to internet and social media use, have undermined national security and could put lives at risk.
But the detention of Mr Miranda and British government pressure on the Guardian newspaper have dragged Mr Cameron into an international row over media freedom and the powers of the security services.