A major terrorism trial is set to be heard entirely in secret in a "totally unprecedented departure" from centuries of open justice in Britain, it can be disclosed.
For the first time in British legal history, two men charged with serious terror offences will be kept anonymous and the press and public will be excluded from their trial, the Court of Appeal heard.
MPs and civil rights campaigners said it was an "outrageous assault" on the principles of open justice and set a "very dangerous precedent".
Prosecutors have successfully applied for the case to be heard in private on grounds of national security but media organisations are trying to overturn the decision.
Journalists have up until now even been banned from reporting the fact that a trial was to be heard in secret.
The move has fuelled concerns over the growth of secret justice in British courts, which has already spread to civil cases and celebrity privacy challenges.
But a major criminal case being heard entirely behind closed doors risks ripping up the very tradition of open justice in the UK, which dates back to the Magna Carta of 1215.
Mr Justice Nicol, a senior Old Bailey judge, ruled last month that the trial of the two men, who are only known as AB and CD, should be heard in camera and that the defendants remain anonymous.
Media organisations, including The Daily Telegraph, have appealed the orders, including a ban on reporting of the legal proceedings.
In the Court of Appeal on Wednesday, Anthony Hudson, for the media groups, said the case was a "totally unprecedented departure from the principle of open justice" and required their "most anxious scrutiny".
"We submit that the orders made mark such a significant departure from the principle of open justice that they are inconsistent with the rule of law and democratic accountability," he said.
"As far as we are aware no order has ever been made that requires the entire criminal trial to be held in private, with the media excluded and defendants anonymous."
He told the senior judges: "This appeal raises important issues relating to not only the constitutional principle of open justice but also the equally important principle of fairness and natural justice.
"This case is a test of the court's commitment to that constitutional principle in the admittedly difficult and sensitive cases where the state seeks to have trials involving terrorism heard in secret and relies in support of that that on grounds of national security."
He added: "National security cannot be pursued without regard of the values of society that it is trying to protect."
Speaking after the hearing Keith Vaz, chairman of the Commons home affairs committee, said: "For a parliamentary democracy with our reputation for a fair legal system, this sets a very dangerous precedent.
"For an entire trial to be heard in camera, this is unprecedented, very serious and worrying."
David Blunkett, the former home secretary, said he was "mystified" by the decision and said it amounted to a "removal of open justice".
"In some cases, there can be justification in terms of the kind of evidence which requires presenting in secret, but it would appear that there is no clarification as to whether this is the case here," he said.
Clare Algar, executive director of Reprieve, said: "To hold trials entirely in secret is an outrageous assault on the fundamental principles of British justice. This Government's dangerous obsession with secret courts seems to know no bounds."
Shami Chakrabarti, director of Liberty, said: "This case is a worrying high water mark for secrecy in our courts."
AB and CD were arrested in "high-profile circumstances", the court heard. AB is charged with preparing terrorist acts and is jointly charged with CD on possessing bomb-making instructions. CD is also charged with possessing an illegal UK passport.
However, the CPS has not disclosed details in public on what the national security case is for requesting their anonymity.
Mr Hudson told the court that the CPS had raised the prospect that holding the case in public would have "disastrous consequences" and could result in the charges being dropped. He said that was an argument that had not been successfully made by them.
Richard Whittam QC, prosecuting, said he agreed with principle of open justice but these were "exceptional circumstances". "There is a justification for the defendants to remain anonymous and there is a justification for the court to sit in private," he said. He insisted that the prosecution application had never relied solely on national security grounds.
New laws passed last year also allow for parts of civil cases to be heard in secret if they involve matters of national security, such as compensation claims from terror suspects.
In the latest case, Lord Justice Gross, Mr Justice Simon and Mr Justice Burnett allowed reporting of the open proceedings before them in the Court of Appeal and said they would give their decision on the main appeal, against trial being held in secret, within a few days.