Rabinni was stopped at Heathrow on November 20, 2016, when his flight landed, and questioned under powers officers can use to question people they suspect of being linked to terrorism.

In court, Rabinni argued that he should not have to give police access to his devices because they contained sensitive documents given to him in confidence by a man he described as a victim of torture by the US government.

The court rejected his argument, saying it was not a valid defence under the law. Journalists and lawyers have certain protections linked to privileged material, but neither applied to Rabinni.

According to the BBC, District Judge Emma Arbuthnot dismissed Rabbani's defence and said he took a "calculated risk" in refusing to hand over the information, which had previously paid off.

He was asked to pay £620 in costs and fees, and was given a conditional discharge, meaning he will go unpunished so long as he commits no crimes for the next 12 months.

However, it remains to be seen whether he has succeeded in protecting the information from police.

Scotland Yard still has his phone and laptop, and said in a press statement that the force is "continuing its efforts to examine the contents."

Dean Haydon, a senior Met Police counter-terror officer, responded to the conviction, saying: "It's crucial that police are able to use the legislation that exists to help keep the public safe."

"I want to thank my lawyers and supporters who were here for me today. Of course, the decision is not one that we had been hoping for, but the judge understood and expressed this case is complicated," he said.