British Attorney General Suella Braverman. | HENRY NICHOLLS

It was the headline that took me back 25 years: “Attorney-General to seek gag on BBC spy story.” The Attorney-General in question is Suella Braverman, who recently seemed to think she had the power to reverse a jury’s verdict over the toppling of statues in Bristol. She hasn’t.

My mind went back to 1987, when I was Editor of The Observer, to two previous attempts by an Attorney-General to ban the BBC and newspapers from publishing stories about spies and other government secrets.

The contested BBC programme is about a British spy, presumably in MI6, who is working overseas. To name him, says the government, “would risk people’s lives.” The BBC claims there is “an overwhelming public interest” in revealing the story.

In the background of the case is the current government’s campaign against the BBC, accusing it of overspending and political bias. The Culture Secretary, Nadine Dorries, who clearly despises the Corporation, has frozen the licence fee for two years and threatened to scrap it.

When the case opened on Wednesday, Mr Justice Chamberlain said there would be a full hearing on March 1 and 2 and promised that he would try to make it as public as possible. On Wednesday the media were required to leave the court for an hour.

In normal circumstances it would clearly be wrong for the media to name an MI6 officer, just for the sake of it, and thereby put him at risk. I can’t believe the BBC would want to do that. But they clearly believe that they have discovered something involving the officer that should be made public.

In my 20-year wrangles with the law over issues like this, a key word was “wrongdoing.” If one could show that someone had been engaged in wrongdoing, then the protection afforded by the Official Secrets Act could be set aside. That may or may not be relevant in this case, since the details have not been revealed and the government is determined to keep it that way.

This is prior restraint, an ugly, undemocratic concept and something forbidden in the American constitution. For that reason I hope the judge throws out the Attorney-General’s plea.

I don’t know if people nowadays remember the scandal over a book called Spycatcher: it made global headlines for two years and ended in a victory for the media and made the Thatcher government look foolish.

The furore turned a rather turgid book, which failed to prove its dramatic claims, into an international bestseller and the author into a millionaire. I was in the witness box for two days when The Observer and The Guardian went to the High Court to seek the removal of a government gag that even prevented us mentioning the content of the book.

A retired MI5 officer, Peter Wright, embittered by the perceived loss of some of his pension, retired to Tasmania to write a book, in contravention of the Official Secrets Act, about the history of MI5. His book included two startling revelations: that a former head of the agency had been a Russian spy and that MI5 had attempted to bring down the former Prime Minister, Harold Wilson, on the grounds that he too was a Russian spy.

Wright’s co-author, incidentally, was a British journalist, Paul Greengrass, who went on to find fame and fortune as director of the Jason Bourne films in Hollywood. When he and Wright tried to have the book published in Australia, the British government sought an injunction, sending out the Cabinet Secretary, Sir Robert Armstrong, who made his famous remark about being “economical with the truth.”

In a legal arm-wrestle with the lawyer Malcolm Turnbull, later Prime Minister of Australia, the British lost the case and the book was published in Australia. From there copies travelled round the world, making the British government’s attempts at secrecy unrealistic. But still they battled on to stop its publication in England (they couldn’t ban publication in Scotland) and Customs were not authorised to stop copies entering England from outside the country.

It became farcical. I remember that one evening between my two sessions in the witness box I went to give out the Speech Day prizes at my old school in Coventry. I was much amused to see that one of the prizes, which I presented to a girl, was a copy of Spycatcher. The next morning I resumed my argument in the High Court that The Observer should no longer be banned from mentioning the book.

Around the same time BBC Scotland prepared a series called “The Secret Society,” in which reporter Duncan Campbell uncovered a new satellite defence system called Zircon, costing £500 million, that was unknown to MPs. In a bid to have the programmes stopped, MI5 and Special Branch raided the BBC offices and Campbell’s home. We revealed the raids in The Observer, setting off what I called “a fit of national hysteria.”

In defence of our story I wrote an article headed “The Journalist as Patriot,” which still seems relevant to the current case 25 years on. “It was hard,” I wrote, “to form an instant view on these matters. The country might need such a satellite, after all, and it might well need to keep its existence secret. How could one tell?

“Perhaps we could afford the additional defence burden; perhaps not. The BBC might have been acting responsibly and on the best advice in first commissioning and then stopping the programme. Or not, as the case may be.

“These were not matters for us to decide. As journalists, our job was to present the facts to the public as we knew them, taking care not to stumble around clumsily in areas of ultra-sensitivity.

“If a government’s job is to keep secrets, part of a reporter’s job is finding them out. An editor’s job is deciding whether to publish them or not. In doing this he may take advice and withhold a story in the interests of national security (by using the D-notice system, for example, which doesn’t seem to have been used in this case).

Or he may go ahead and publish anyway on the grounds that the public ought to know. He may turn out to be right or wrong either way.

“But what makes a journalist think he’s entitled to decide about a state secret when nobody elected him to do that? The best answer I know to that common charge is contained in the remarks of a judge in the Pentagon Papers case (where the New York Times published secret Pentagon briefings about the Vietnam war).”

“Security,” said the judge, “also lies in the value of our free institutions. A cantankerous press, an obstinate press, a ubiquitous press, must be suffered by those in authority in order to preserve the even greater values of freedom of expression and the right of the people to know.”

As for giving secrets to the enemy, there is nothing to compare with the record of the security services themselves. Traitors and defectors have left a far more deadly trail of havoc than the BBC could ever do.