The country's most senior judge, Lord Thomas, at the Court of Appeal dismissed an appeal by media groups to lift reporting restrictions surrounding the prosecution of London-based law student Erol Incedal, who was acquitted at the end of a trial last year.
The judge said that the restrictions were necessary "in the interests of national security."
He was accused of plotting with a militant in Syria either to target high-profile people such as former Prime Minister Tony Blair or planning a Mumbai-style attack using a gun.
In addition, parts of the trial were held in secret, with the press as well as the public excluded. Only 10 of the almost 70 hours of evidence were heard in open court.
More From This Section
Media organisations had challenged a decision by the trial judge to refuse to lift reporting restrictions.
Upholding the court's decision to keep the details of the Old Bailey trial court in London secret, the judge said, "It remains likely that judges will for some time be faced with determining applications for parts of trials to be held in camera for reasons of national security and that there will be appeals to this court."
Incedal was cleared of planning a gun attack at the end of the trial in March last year, but he was jailed for three-and-a-half years last April for possessing a bomb-making manual on a memory card he had at the time of his arrest in October 2013.
He had been convicted of that offence at a previous trial in 2014.
His friend Mounir Rarmoul-Bouhadjar, who had admitted having an identical document, was jailed for three years by trial judge Justice Nicol.
Appeal judges lifted the anonymity, saying the defendants should be named, and declared that while the "core" of the trial could be held in secret it must start and end in public.
UK media organisations had claimed there is substantial and genuine public interest in reporting of the matters that lay at the heart of the prosecution's case against Incedal.