A British court has validated the use of an anti-terrorism law by London police last year to detain a Brazilian national who was ferrying classified American documents between journalists.

David Miranda was stopped at Heathrow Airport and interrogated for nine hours by authorities who claimed they could do so under Schedule 7 of Britain’s Terrorism Act.

That law was established with the intent to keep terrorists from entering the country.

Miranda, however, was merely serving as courier, carrying copies of National Security Agency documents released by whistleblower Edward Snowden from Laura Poitras in Berlin to Glenn Greenwald, whom Miranda lives with in Rio de Janeiro.

A White House spokesman confirmed that the UK had given them a “heads up” regarding the detention when it was about to happen, but insisted it “was not something we requested.”

Although Miranda was acting as a messenger on behalf of journalists, three judges on London’s High Court of Justiceruled (pdf) that his detention was justified due to “very pressing” issues of national security.

The court did note that the detention represented “an indirect interference with press freedom.”

Police argued Miranda was subject to the anti-terror law because he was “likely to be involved in espionage activity” and met the technical definition of a terrorist because he was “knowingly carrying material, the release of which would endanger people’s lives” and was promoting a “political or ideological cause,” according to documents made public during the court case.

A number of British politicians took issue with the application of the terrorism law in this case. “The clause in this act is not meant to be used as a catch-all that can be used in this way,” Parliament Labour Party member Tom Watson told the media. “It’s almost impossible, even without full knowledge of the case, to conclude that Glenn Greenwald’s partner was a terrorist suspect.”

Miranda said he intends to appeal the ruling to a higher court.

“I’m of course not happy that a court has formally said that I was a legitimate terrorism suspect, but the days of the British Empire are long over, and this ruling will have no effect outside of the borders of this country,” Miranda said in a statement provided to The Intercept, which now employs Greenwald. “I’m convinced they’ve hurt their own country far more than me with this ruling, as it emphasizes what the world already knows: the UK has contempt for basic press freedoms.”