Media playback is unsupported on your device Media caption David Miranda's lawyer: "We consider this to be a partial victory"

Material seized from a Brazilian man held at Heathrow airport under anti-terror laws can only be examined for national security purposes, judges say.

An injunction stops government and police "inspecting, copying or sharing" material taken from David Miranda, including data on his computer.

The 28-year-old is the partner of a Guardian journalist who exposed secret information on US surveillance.

The government's independent reviewer of terrorism laws is to probe the case.

Meanwhile, police have launched a criminal inquiry but have not given specific details.

The High Court ruled the authorities could examine the seized material for the defence of national security and also to investigate whether Mr Miranda, 28, is a person who is or has been concerned with the commission, preparation or instigation of acts of terrorism.

Mr Miranda's lawyers said he had had nine items, including his laptop, mobile phone, memory cards and DVDs, taken during the detention on Sunday.

They sought the injunction to prevent access to the data, arguing his detention was unlawful and threatened "journalistic sources whose confidential information is contained in the material seized".

Speaking after the case, Gwendolen Morgan, from law firm Bindmans, said the injunction was a "partial victory".

She said the government now has seven days to "prove there is a genuine threat to national security".

Ms Morgan added she knew "very little" about the criminal investigation police revealed they were undertaking.

"We don't know of any basis for that," she added.

'Highly sensitive material'

Image copyright AFP Image caption David Miranda (left) was met by Glenn Greenwald when he arrived back in Brazil

Mr Miranda, who was travelling from Berlin to Rio de Janeiro where he lives with journalist Glenn Greenwald, was stopped in connection with the classified data on American and British surveillance programmes leaked to the Guardian from whistle-blower Edward Snowden.

Mr Snowden, a former contractor with the National Security Agency in the US, has been granted temporary asylum in Russia.

Mr Miranda was detained for nine hours at Heathrow under schedule 7 of the Terrorism Act 2000.

The law allows police to hold someone for up to nine hours for questioning about whether they have been involved with acts of terrorism.

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 insofar as it falls within the purposes of the original Schedule 7 examination and in order to protect national security.

"It would be inappropriate for us to comment further on ongoing legal proceedings."

The judicial review proceedings involved the Home Office and the police.

Material taken from the claimant includes material the unauthorised disclosure of which would endanger national security of the UK and put lives at risk Steven Kovats QC

A lawyer for the police revealed during the court hearing that they were launching a criminal investigation after examining some of the material.

Jonathan Laidlaw QC did not give any details about the investigation but said the material "contains in the view of the police highly sensitive material, the disclosure of which would be gravely injurious to public safety".

Lord Justice Beatson and Mr Justice Kenneth Parker were told Home Secretary Theresa May believed it was necessary to examine the documents "without delay in the interests of national security".

Steven Kovats QC said Mrs May had given "careful consideration" to Mr Miranda's requests and had offered "more narrowly defined" undertakings which the court should accept.

But he said: "Material taken from the claimant includes material the unauthorised disclosure of which would endanger national security of the UK and put lives at risk."

On Wednesday, Mrs May defended the police's use of anti-terrorism laws, insisting such action "was right" if officers thought Mr Miranda was holding information useful to terrorists.

There will be a full hearing on the question of continuing police inspections on 30 August.

The High Court will then further consider Mr Miranda's application for an interim injunction to stop examination "until the legality of that seizure has been determined by this court".

Legislation questioned

Earlier, the secretary general of the European human rights watchdog the Council of Europe, Thorbjorn Jagland, warned the Home Office the detention of Mr Miranda "may have a potentially chilling effect on journalists' freedom of expression".

Media playback is unsupported on your device Media caption David Miranda told the BBC he felt very threatened during his detention

And EU Justice Commissioner Viviane Reding tweeted: "I fully share Mr Jagland's concerns."

Brazil's Foreign Minister Antonio Patriota said his country was waiting for an explanation from Britain, but believed "this was an isolated incident and won't happen again".

Later, David Anderson QC, the government's independent reviewer of terrorism legislation, announced his inquiry and said it would "concentrate on the use made by police of the Schedule 7 powers in this case, from the moment when their use was first considered until the release of Mr Miranda".

He said: "This will inevitably involve consideration of whether the powers were lawfully, appropriately and humanely used, of the processes that were applied in order to ensure that this was the case and of any alternatives that were or might have been considered."

Mr Anderson's announcement came after a former director of public prosecutions questioned the value of the legislation.

In an interview for BBC Radio 4's World At One programme, Lib Dem peer Lord MacDonald said the section of the law that allows the police to stop, examine and search passengers at ports and airports, with no requirement for reasonable suspicion, was "problematic" and "not very practical in terms of catching people involved in terrorism."