Judges curtail using or sharing of material, but authorities can examine it for 'national security'

Police use of data seized from the partner of the Guardian journalist who exposed mass digital surveillance by US and UK spy agencies was partially and temporarily curtailed on Thursday by the high court.

Lord Justice Beatson and Judge Kenneth Parker issued an injunction blocking the government from using or sharing material seized from David Miranda at Heathrow on Sunday in a criminal investigation – half an hour after a Metropolitan police lawyer announced the force had launched such an investigation.

Jonathan Laidlaw QC, appearing for the Met, said the data Miranda was taking to Brazil for his partner, Guardian journalist Glenn Greenwald, contained "highly sensitive material the disclosure of which would be gravely injurious to public safety". There were tens of thousands of pages of digital material, he said.

The Home Office and Met won the right to continue examining the data in the protection of national security or for investigating whether Miranda himself was involved in terrorism. The Met said it was pleased by the ruling.

Miranda's lawyer, Gwendolen Morgan, described it only as a partial victory and said while the Home Office and police were now facing "significant prohibitions" on use of the data, "if this decision remains unchallenged it will have serious chilling effects for journalists worldwide".

Guardian News & Media, publisher of the Guardian, which is supporting Miranda's legal action, said it had "grave concerns that the judgment allows police to examine without any legal oversight journalistic material seized from David Miranda". It added: "It remains our position that David Miranda was involved in legitimate journalistic activity."

The judges had been asked by Miranda's lawyers to review the legality of the government's use of anti-terror legislation against someone they argued was engaged in aiding journalists. They had called for a wholesale injunction against the police and its agencies from inspecting, sharing or copying the data seized on memory sticks, a hard drive, laptop, mobile phone and games console Miranda was carrying when detained for nine hours under schedule 7 of the Terrorism Act 2000.

Under the schedule, UK police can stop, examine and search passengers at ports, airports and international rail terminals. Unlike with some other police powers to stop and search, there is no requirement for an officer to have a "reasonable suspicion" that someone is involved with terrorism before they are stopped.

A Home Office lawyer said the material seized from Miranda as he was in transit from Berlin to Rio de Janeiro included tens of thousands of classified UK intelligence documents "disclosure of which would risk lives".

The Met welcomed the decision "which allows our examination of the material to continue in order to protect life and national security, and for the purposes of the schedule 7 examination [ie whether Miranda is a terrorist].

"Initial examination of the material seized has identified highly sensitive material, the disclosure of which could put lives at risk. As a result the Counter Terrorism Command (SO15) has today begun a criminal investigation. This investigation is at an early stage and we are not prepared to discuss it in any further detail at this stage."

Miranda had just visited Laura Poitras, a film-maker who was involved in breaking the revelations by fugitive US whistleblower and former CIA contractor Edward Snowden. His lawyers told the court in a written submission that police threatened him with jail if he did not answer their questions and compelled him to provide passwords for the devices he was carrying. He only had a lawyer for the last hour of his detention and was not allowed apen to write down the officers' questions or a translator.

"At its heart this is about the seizure of journalistic materials from somebody working with a journalist," Matthew Ryder QC, for Miranda, told the court. He said terrorism powers were being misused to obtain confidential journalistic information bypassing existing legal routes which allow authorities to do that with explicit safeguards. The use of anti-terror laws also violated Miranda's right to freedom of expression provided by article 10 of the European convention on human rights.

Steven Kovats QC, counsel for Theresa May, said the home secretary "does not accept that we are concerned here with journalistic material" and believed Miranda "is not a journalist, and stolen documents can't be held in confidence and don't qualify as journalistic materials".

A hearing on how the courts will allow the authorities to use the material seized from Miranda in the longer term has been scheduled for next Friday. A full hearing into the legality of the UK authorities' use of the counter-terror laws against Miranda is not likely to happen until October and May might apply for that hearing to be held in secret, the court heard.

The injunction permits the authorities to "inspect, copy, disclose, transfer, distribute" the data in the protection of national security or for investigating whether Miranda himself "is a person who is or has been concerned in the commission, preparation or instigation of acts of terrorism".

• This article was amended on 23 August 2013. An earlier version misspelled Lord Justice Beatson's name as Beaston.