David Miranda, partner of the former Guardian journalist Glenn Greenwald, has been granted permission to appeal against a ruling that he was lawfully detained under counter-terrorism powers at Heathrow airport.

The case – which also involves a challenge to the police seizure of computer material related to the US National Security Agency (NSA) contractor Edward Snowden – will now go to the court of appeal.

In February, three high court judges – Lord Justice Laws, Mr Justice Ouseley and Mr Justice Openshaw – concluded that Miranda's detention at Heathrow under schedule 7 to the Terrorism 2000 Act in last summer was legal, proportionate and did not breach European human rights protections of freedom of expression.

The judgment stated that Miranda, a Brazilian national, was stopped in transit between Berlin and Rio de Janeiro after meeting the film-maker Laura Poitras. He had been carrying encrypted files, including an external hard drive containing 58,000 highly classified UK intelligence documents, "in order to assist the journalistic activity of Greenwald". The Guardian made his travel reservations and paid for the trip.

Greenwald had told the court that the security services were well aware the seized material was in connection with journalism and not terrorism. He said there was no evidence to indicate that any disclosure had actually threatened or endangered life or any specific operation.

But the high court ruled that Miranda's nine-hour detention and the seizure of his computer equipment was lawful because although it was "an indirect interference with press freedom", there was not only compelling but "very pressing" evidence of a risk to national security.

During the hearing last November, a Cabinet Office official testified that the release of the GCHQ files Miranda was carrying would be very likely to cause great damage to security and possible loss of life.

The judges declined to recognise that the seized files were primarily "journalistic material". Describing them as "stolen raw data", the judgment said that the balance of public interest was "plainly in favour of national security" rather than press freedom.

One of the grounds for granting permission to appeal was that the supreme court has recently decided to hear a related case, Beghal v DPP, which raises similar issues of whether the schedule 7 powers - under which so called 'port stops' are conducted - are compatible with European convention on human rights.

Welcoming the decision, his solicitor, Gwendolen Morgan of Bindmans, said: "In giving Mr Miranda's case the green light, the court of appeal noted the importance of the issues and the compelling legal arguments raised in his case.

"We look forward to the appeal being heard as calls for reform of schedule 7 grow alongside concerns around the dangerous conflation of investigative journalism with terrorism which was starkly illustrated by Mr Miranda's detention."

• This story was amended on 15 May 2014 to clarify details of the high court judgment.