A UK court has limited authorities’ access to digital data that was seized from the partner of Guardian journalist Glenn Greenwald, except in the case of national security purposes.

David Miranda was detained and questioned for nearly nine hours Sunday as he transited through Heathrow airport in London on his way back to his home in Rio de Janeiro.  Officials had confiscated several pieces of Miranda’s electronics equipment, under a provision of a UK terrorism law.

Attorneys for Miranda sued to prevent authorities from “inspecting, copying or sharing” any of the material from the items confiscated during Miranda’s detention.

The court issued a limited injunction on Thursday, placing some restrictions on how the materials can be used.

From The Guardian:

David Miranda has been granted a limited injunction at the high court to stop the government and police “inspecting, copying or sharing” data seized from him during his detention at Heathrow airport – but examination by the police for national security purposes is allowed.

Miranda had taken the government to court to try and get the data returned, but judges ruled that the police would be able to make limited use of what had been taken during his nine-hour detention on Sunday. He is the partner of Glenn Greenwald, the Guardian reporter who has exposed mass digital surveillance by US and UK spy agencies.

The court ruled the authorities must not inspect the data nor distribute it domestically or to any foreign government or agency unless it is for the purpose of ensuring the protection national security or for investigating whether Miranda is himself involved in the commission, instigation or preparation of an act of terrorism.

Gwendolen Morgan, an attorney for Miranda, elaborated further on the court’s ruling.

From Ars Technica:

“The court accepted today that in order for the home office and police to look at that material, there has to be a genuine threat to national security,” Gwendolen Morgan, Miranda’s lawyer, said. “The home office and police now have seven days to prove that there is a genuine threat to national security rather than make mere assertions as they have done today.”

She added that Miranda would have his items returned as of “midnight on Saturday.”

“We therefore consider this to be a partial victory and we hope to have the court’s full reasoning tomorrow afternoon,” she said.

Reading from an official court document, Morgan said that the Home Office and British police were not to “inspect, copy, disclose, transfer, [or] distribute [the data], whether domestically or to any foreign government or agency,” but that included an exception in the name of “national security.”

Authorities indicated that an initial examination has identified sensitive material on the items seized from Miranda, according to Ars Technica.

Jonathan Laidlaw, an attorney representing the Metropolitan police, described the data to the court as “highly sensitive material the disclosure of which would be gravely injurious to public safety.”

There were “tens of thousands” of pages of digital material, Laidlaw added.

A spokesman for Scotland Yard declined to comment any further, saying, “This [criminal] investigation is at an early stage and we are not prepared to discuss it in any further detail at this stage.”

Information on the activities of a British internet-monitoring station in the Middle East is said to have been contained in the leaked NSA documents from Edward Snowden, an issue that could be driving some of Britain’s security concerns, according to The Independent.

But there are fears in Government that Mr Greenwald – who still has access to the files – could attempt to release damaging information.

He said after the arrest of Mr Miranda: “I will be far more aggressive in my reporting from now. I am going to publish many more documents. I have many more documents on England’s spy system. I think  they will be sorry for what they did.”

One of the areas of concern in Whitehall is that details of the Middle East spying base which could identify its location could enter the public domain.

Greenwald made those statements earlier this week when speaking to reporters just after his partner’s detention.  Such statements are an issue that has even some privacy advocates concerned.

Miranda was returning home after visiting with Greenwald’s colleague Laura Poitras in Berlin when he was detained.  Poitras is the US filmmaker who produced the video interview that unmasked Edward Snowden to the world as the source of the NSA surveillance program leaks.  She has been described as the ‘mastermind’ behind the Snowden disclosures.  Poitras also previously revealed many of the same claims as Snowden’s in an interview she filmed with Bill Binney, and she produced the 2010 documentary “The Oath,” which featured two men who worked for Osama bin Laden.

On Monday, Guardian editor Alan Rusbridger revealed that, weeks ago, security experts with the UK Government Communications Headquarters (GCHQ) oversaw the destruction of hard drives containing documents leaked by former NSA contractor Edward Snowden.