Mulcaire was jailed briefly in 2007 for hacking the voicemails of royal aides. He has now pleaded guilty to new charges, including hacking Dowler's phone.
Three former News of the World news editors have also pleaded guilty, but those who were above them, including Brooks and Coulson, have denied knowing about the hacking.
Edis said that claim was barely credible. Mulcaire was paid about 100,000 pounds a year under both Brooks and Coulson for his services.
"Did nobody ever ask, 'What are we paying this chap for?'" he said. "Somebody must have decided that what he was doing was worth an awful lot of money. Who was that?"
The prosecutor's forensic analysis of the phone-hacking trail was overshadowed by his revelation about Coulson and Brooks' private lives. The two defendants, sitting side-by-side in the dock at the rear of the court, did not visibly react as the lawyer spoke.
Edis said the revelation was "likely to attract a great deal of publicity," some of it "unfair, unkind and unnecessary," but insisted it was relevant.
He said the affair was revealed when police investigating phone hacking in 2011 found an intimate letter written by Brooks to Coulson on a computer in her London home.
He said the 2004 letter was Brooks' reply to Coulson's attempt to end the affair. It's not clear whether it was ever sent.
"You are my very best friend. I tell you everything, I confide in you, I seek your advice, I love you, care about you, worry about you, we laugh and cry together," Brooks wrote in the letter read by Edis in court. "In fact, without our relationship in my life I am really not sure I will cope."
Brooks edited the News of the World from 2000 to 2003, then went on to edit The Sun, and later became the chief executive of Murdoch's British newspaper division. Coulson edited the News of the World from 2003 to 2007.
Brooks married soap-opera star Ross Kemp in 2002. They later divorced and she married horse trainer Charles Brooks in 2009. Coulson married in 2000.
The affair apparently ended before Coulson became communications director for Conservative party leader Cameron in 2007, a job he continued when Cameron was elected prime minister in 2010.
Both he and Brooks resigned from their jobs after the hacking scandal exploded in 2011.
Jill Lawless can be reached at http://Twitter.com/JillLawless
Outpatient ROBOTIC HYSTERECTOMY. Trust an experienced Robotic Surgeon.