Andy Coulson, a former editor for media mogul Rupert Murdoch and spin doctor for British Prime Minister David Cameron, was found guilty Tuesday of conspiring to hack phones in one of the biggest media trials in British history. Rebekah Brooks, Coulson’s codefendant and former boss, was cleared of all charges.

It was a dramatic end to an eight-month trial — one of the longest and most expensive in British history — that stemmed from revelations that reporters at Murdoch’s News of the World tabloid illegally intercepted the voice mails of thousands of Britons. The scandal, which reached a fever pitch three years ago, rocked the British establishment, revealing the cozy relationship between the press, police and politicians.

The fall of Coulson, 46, who was found guilty of plotting to intercept voice mails while he was editor at the News of the World, forced an apology from Cameron, who is facing a national election in less than a year and whose judgment in hiring Coulson has come under renewed scrutiny.

Brooks, 46, the former head of News International, Murdoch’s British newspaper arm, was cleared of all charges. Among the allegations against her were conspiracy to hack phones and pay public officials.

Her acquittal will no doubt be welcomed by Murdoch, who once said that his priority in the phone hacking case was “this one,” gesturing her way.

When the verdicts were read out at the Old Bailey court in central London, Coulson looked on impassively while an emotional Brooks appeared to mouth the words “thank you.”

At the height of the scandal in 2011, Cameron promised to offer a “profound” apology for hiring Coulson if the former aide was found complicit in phone hacking.

The prime minister kept that pledge Tuesday, telling the BBC: “I’m extremely sorry that I employed him. It was the wrong decision.”

Coulson left the News of the World in 2007 after the paper’s royal editor was jailed for phone hacking, saying that he took responsibility but denying any wrongdoing himself. Cameron hired him a few months later, arguing that Coulson deserved a “second chance.”

Other defendants — including Brooks’s husband, Charlie Brooks; her former secretary, Cheryl Carter; and Mark Hanna, the former head of security for News International — were acquitted on the charge of conspiracy to pervert the course of justice.

Stuart Kuttner, a former managing editor of the News of the World, was cleared of conspiracy to hack phones.

On Wednesday, the jury was discharged after failing to reach verdicts on further charges against Coulson and Clive Goodman, the former royal editor. The charges related to paying police officers for access to telephone directories containing numbers for members of the royal household. Prosecutors said they would decide by Monday on whether they will seek a retrial on these charges.

The incident that blew the scandal wide open was the revelation that the cellphone of a murdered schoolgirl had been hacked in 2002 after she was reported missing. Brooks was editor the News of the World at the time; Coulson, her on-off lover, was her deputy.

Soon after the 2011 revelation, Murdoch closed the 168-year-old paper.

In the case of Brooks, “there was no smoking gun,” said Roy Greenslade, a professor of journalism at City University in London. He said that with Coulson, “people could link him much more to ordering stories and being shown stories” that resulted from phone hacking.

At one point in the trial, Coulson admitted to listening to a hacked voice message but said he had no knowledge that the practice was widespread.

The marathon case highlighted the attack-dog culture of British tabloids and the lengths to which reporters would once go to secure exclusives. For instance, Brooks told the court that the News of the World once paid about $250,000 for an exclusive story involving the prostitute caught with actor Hugh Grant in 1995.

The court also heard that Kate Middleton’s phone was hacked more than 150 times and that journalists at the News of the World would intercept the voice mails of rivals at the Mail on Sunday in the pursuit of scoops.

But the phone hacking scandal, which has prompted a judge-led inquiry and several police investigations in addition to the trial, may have tamed the hounds of Fleet Street, analysts say.

“There are very few kiss-and-tell stories of the old kind. What the scandal has done is made the tabloids much more aware of ethics than they were previously. They have had a nasty shock,” Greenslade said.