The impact of the Snowden affair continues to play out in unexpected ways, with the latest development being a boost to journalistic freedom in the United Kingdom.
The Court of Appeal of England and Wales ruled Tuesday that the U.K.’s Terrorism Act of 2000 was incompatible with European human rights legislation, because it lacks safeguards for journalists’ right to free expression. The British government will now have to add these safeguards.
The ruling came in the case of David Miranda, the husband of Glenn Greenwald, the lead journalist in publicizing Edward Snowden’s surveillance revelations (then for The Guardian and now at The Intercept).
Back in August 2013, not long after Greenwald and his erstwhile Guardian colleagues began publishing Snowden’s NSA and GCHQ information, Miranda found himself detained for nine hours’ questioning at London’s Heathrow Airport. He was carrying encrypted information from the Snowden stash that he had picked up from filmmaker Laura Poitras in Berlin and was taking back to Greenwald in Brazil.
The police detained Miranda under the Terrorism Act, on the basis that the intended publication of the material he was carrying was “designed to influence a government, and is made for the purpose of promoting a political or ideological cause [and] therefore falls within the definition of terrorism.” They took from him what they claimed was around 58,000 highly classified U.K. intelligence documents.
Miranda launched a judicial review against the authorities but lost his case on all counts—hence the appeal that bore fruit today.
For more read Edward Snowden just got a huge win in Europe
Greenwald’s spouse certainly did not claim an outright victory. The court rejected his lawyers’ argument that the police misused their powers in detaining him, and said the publication of this sort of material could indeed amount to terrorism—though it disagreed with the lower Divisional Court about the literal interpretation of the t-word. The lower court had ruled that journalists and protestors could become terrorists by accidentally putting lives at risk, but the Court of Appeal said intention had to be taken into account.
The appeals court even said Miranda’s right to freedom of expression had been outweighed by national security interests in this case.
However, the big win for Miranda and the press freedom organizations backing him in the case came from the court’s decision that there were not enough legal safeguards against the anti-terrorism law being arbitrarily exercised against journalists.
Sign up for Data Sheet, Fortune’s technology newsletter.
Specifically, in cases such as Miranda’s, the law makes no provisions for a court or some other impartial body to decide whether it’s justifiable to override journalistic free expression in the interests of national security. This lack of safeguards undermines the confidential relationship between journalists and their sources, and could therefore have a chilling effect on journalism.
That makes the law incompatible with Article 10 of the European Convention on Human Rights, which covers free expression. So the authorities were not wrong to apply the law to Miranda—the law itself was at fault.
Here’s the kicker in the court’s judgement:
“If journalists and their sources can have no expectation of confidentiality, they may decide against providing information on sensitive matters of public interest. That is why the confidentiality of such information is so important.”
Press freedom organizations were happy with this aspect of the ruling, if not the others.
“The seizure of David Miranda’s data set a disturbing precedent on a story of global importance and we are relieved that the Court has recognised the fundamental necessity of protecting confidentiality for journalists,” said Jo Glanville, the director of English PEN.
The Home Office was of course more pleased with the other parts of the judgement. “We have always been clear that David Miranda’s examination by police under Schedule 7 was lawful and proportionate. The Court of Appeal’s judgment in this case supports the action taken by police to protect national security,” a spokesperson said.
What’s More Important: Privacy or National Security?
However, the Home Office also noted the bits about safeguards, and claimed it last year changed its code of practice to tell officers not to examine any journalistic material.
“This goes above and beyond the Court’s recommendations in this case,” the spoesperson said.
That may be true, but it doesn’t change the fact that the Terrorism Act will now have to be amended. When it comes to fundamental rights, codes of practice don’t quite cut it.