Andy Coulson's on-off affair with Rebekah Brooks went on for nine years and stopped for good only around the time he resigned as editor of the News of the World, the hacking trial was told Friday.
He received a £600,000 payoff from the paper when he quit, the jury also heard on Friday, and months later got job with David Cameron.
The relationship began before Coulson became Brooks's deputy at the News of the World (NotW) in 2000 and continued for periods after he took over the helm and she moved to the Sun in 2003, the court heard.
In an anguished letter Brooks wrote but never sent in February 2004, she said she had been "waiting for six years" for him.
But today, Coulson, a married father of three, said it was "not a wholly accurate representation" of events and revealed the affair ended around the time he left the Sunday tabloid in January 2007.
The jury has already heard Brooks admit the "dysfunctional" affair, which the prosecution believed went on between 1998 and ended in 2004 because of the date of a draft letter found on her computer by police.
She described Coulson as her "very best friend" and told him: "I love you."
Former Downing Street spin doctor Andy Coulson
The pair are accused of being part of a conspiracy to hack phones at the now-defunct newspaper between October 2000 and August 2006.
Under cross-examination by prosecutor Andrew Edis QC, the ex-No 10 spin doctor told the court that he had a different interpretation from his co-defendant.
He said the affair started in 1998 and stopped "soon after" but it resumed around the end of 2003 or early 2004.
He said: "In between time, there was a very long period the relationship was what it should have been, which was friendship.
"From 2004 it was by no means continuous but the affair did continue until around the time I left the NotW."
Rebekah Brooks was the editor of the News of the World, the Sun, and latterly the chief executive of News International
Asked if Brooks's version was wrong, Coulson replied: "I'm not using the words completely false - it was a very complicated situation. People have different interpretations of it on both sides."
His wife Eloise was in court as he gave evidence for the seventh day at the Old Bailey.
Months after he quit the paper he went to work as David Cameron's director of communications.
The jury heard that around April he was in talks with George Osborne about the role. He met Cameron and following the local elections in May a job offer was made.
Coulson is facing three charges including one that he conspired to hack phones. He denies all charges.
The trial continues.