Warning : this article omits information that the Guardian and other news organisations are currently prohibited from publishing

Media appeal against courtroom secrecy in Erol Incedal trial hears remarks from top judge that MI6 and MI5 must comply with public prosecution

The accountability of MI5 and MI6 and the question of whether they are fully subject to the rule of law lie at the heart of attempts by the media to sweep away the secrecy surrounding a major terrorism trial, the lord chief justice said on Monday.

In a series of remarks that disclosed publicly for the first time the role that the UK’s security and intelligence agencies played in imposing secrecy on the trial of Erol Incedal, a London law student, Lord Thomas of Cwmgiedd told the court of appeal that public confidence in the way they do their work was a key issue in the case.

Furthermore, he said, the representations that the agencies had made to the director of public prosecutions, and which led to the unprecedented courtroom secrecy, raised matters of “high constitutional importance”.

The court heard that crown prosecutors had received representations from the agencies before Incedal went on trial, and had then argued that there was a danger the case might not proceed unless it was held in complete secrecy.

Thomas warned on Monday: “One thing the security services cannot do is to say they will not hand over material to the prosecution. That is absolutely impermissible.

“It cannot be for the security services to say: ‘Well we may not cooperate’, because that would suggest that they are not subject to the rule of law.”

He added: “One of the issues [in the appeal] is the public having confidence in the way the security services work. The accountability of the security services is another issue that arises.”

Thomas disclosed that both agencies has been invited to give evidence at the media’s appeal, which is resuming after being adjourned in July, but had declined to do so. “We did ask MI5 and MI6 to make submissions [to the court] but they chose not to.”

Although the media can now report that MI5 and MI6 played a key role in the imposition of the unprecedented secrecy that surrounded the trial of Incedal last year, and his retrial last March, the reporting restrictions that remain in place mean that the reasons that the agencies demanded such measures can still not be lawfully disclosed.

Reporters who were permitted to attend the trials – but not report on the secret evidence – have since had their notebooks impounded.

Members of both juries were warned that they could imprisoned if they disclosed the secret evidence that they heard.

Lawyers representing UK media organisations are arguing that the reporting restrictions should be lifted so that the public can be informed about the matter at the core of the case that was brought against Incedal. Currently, this remains hidden from view. The court of appeal has received statements from both the home secretary and the foreign secretary, in which they oppose the media’s appeal, but schedules attached to those statements have not been disclosed to the media’s lawyers. This, said Anthony Hudson QC, for the media, was “profoundly unfair”.

Incedal, 27, was arrested two years ago and found to be in possession of a bomb-making manual on a memory card hidden inside his mobile phone case.

He argued at his Old Bailey trial that he had a reasonable excuse for having the manual in his possession. The jury rejected this claim, however, and he was jailed for 42 months.

His friend Mounir Rarmoul-Bouhadjar, also 27, pleaded guilty to possession of the same manual and was jailed for three years. Both men have since been released from prison.

However, the jury failed to reach a verdict on the more serious charge that Incedal faced, that of planning a terrorist attack. After a retrial, a second jury acquitted him.

The reasons why the jury reached this verdict cannot currently be reported. The media’s appeal continues.