Old Bailey judge expresses concern PM apologised for hiring former NoW editor while jury were still deliberating over charges

David Cameron has been rebuked by the judge presiding over the hacking trial after his comments about Andy Coulson nearly led to the collapse of the remainder of the case against his former spin doctor.

Mr Justice Saunders expressed concern that the prime minister had issued an apology for hiring him in 2007 while the jury were still deliberating over two charges against Coulson.

"I don't know whether it was was done out of ignorance or done deliberately," Saunders said at the Old Bailey legal hearing.

The judge said Cameron's intervention on Tuesday after the jury found Coulson guilty of a hacking charge was "unsatisfactory" and needed to be avoided in future. Two further charges were still being considered and the prime minister did not seem to understand that his televised statement was putting material into the public domain that could have prejudiced the remainder of Coulson's trial.

However, Saunders rejected an application by Coulson's defence team to have the charges thrown out because of the "maelstrom of commentary" by Cameron, the Labour leader, Ed Miliband, and George Osborne, the chancellor of the exchequer. But his concern was clear.

The judge said he had asked the prime minister for an explanation on Tuesday evening as to why he had issued a statement while the jury were still out and was told by his principal private secretary: "The prime minister was responding to the guilty verdict on hacking charges that had been delivered in open court.'

Saunder said that explanation "misses the point".

"He [Cameron] has now told the public and therefore the jury that he was given assurances by Mr Coulson before he employed him which turned out to be untrue." The jury were not aware of this and it could affect Coulson's credibility in their eyes and therefore prejudice a fair trial, Saunders said.

"I consider that what has happened is unsatisfactory so far as justice and the rule of law are concerned," said Saunders.

It is the second time this year Cameron has been admonished by a judge for remarking on active court proceedings. The judge in the trial of Nigella Lawson's two former personal assistants said it was "of regret" that Cameron had spoken out in favour of Lawson in an article in the Spectator magazine.

Counsel for Coulson told the hacking trial judge it was "astonishing" and "unprecedented for a prime minister to make public comments at such a crucial juncture in trial proceedings".

Saunders said the press covering the Old Bailey trial had been "extremely responsible" over the past eight months, but that when politicians consider it "open season" to comment on trials the media cannot be expected to remain silent.

Saunders formally discharged the jury at about 12.30pm on the ninth day of their deliberations after they failed to reach a majority verdict on the outstanding charges against Coulson and his co-defendant on the counts, Clive Goodman, the former royal editor of the News of the World.

Downing Street said Cameron made his statement after receiving legal advice, but was initially reluctant to confirm whether that advice had come from the attorney general, Dominic Grieve.

During legal argument on Tuesday, Timothy Langdale, QC for Coulson, said the attorney general was with the prime minister when he made contact, although he did not know if was in relation to this matter.

The prime minister's spokesman later confirmed that advice had come from Grieve.

Cabinet veteran Kenneth Clarke also criticised Cameron, saying he had appeared not to have considered the legal implications when he made his remarks.

"It was unwise. They should have taken some legal advice first but I doubt whether it ever crossed David's mind," he told BBC Radio 4's The World at One.

Ending the trial, Saunders said the country owed the jury "a great debt of gratitude" for giving up eight months of their lives at great personal inconvenience.

"This is a case which had to be heard and had to be decided by a jury. It arose out of considerable public concern about behaviour of journalists at the News of the World. The public were entitled to know who was criminally involved at a senior level at the NoW. You have made this decision," he said.

Crown prosecutors will decide by Monday whether they want to retry Coulson and Goodman.

Coulson will be sentenced on Friday next week on the phone-hacking charge along with five others.