REBEKAH Brooks, the former News International chief executive, and Andy Coulson, the former News of the World editor, who went on to become David Cameron's director of communications in Downing Street, had a secret affair lasting at least six years, the Old Bailey has been told.

The jury heard how Ms Brooks declared her love for Mr Coulson in a letter in February 2004, when he had tried to end their relationship. The pair were said to have been having an affair dating back to around 1998, spanning the period covered by the phone-hacking conspiracy charge.

Ms Brooks, who was editor of the now defunct Sunday tabloid when Mr Coulson was her deputy, wrote: "The fact is 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. In fact, without our relationship in my life I am not sure I will cope."

Prosecutor Andrew Edis QC told the jury of nine women and three men that he was not revealing the affair to intrude deliberately into the pair's privacy or to make a moral judgment.

"But," he explained, "Mrs Brooks and Mr Coulson are charged with conspiracy and, when people are charged with conspiracy, the first question a jury has to answer is how well did they know each other? How much did they trust each other?

"And the fact that they were in this relationship which was a secret means that they trusted each other quite a lot with at least that secret and that's why we are telling you about it."

Mr Edis noted how the revelation of the relationship was important because "what Mr Coulson knew, Mrs Brooks knew, and what Mrs Brooks knew, Mr Coulson knew".

Ms Brooks remained with her head bowed and Mr Coulson looked ahead towards the prosecutor as their affair was revealed to the jury.

The court heard that Ms Brooks went on holiday to Dubai in April 2002 but remained in contact with Mr Coulson while she was away as the newspaper planned to run a front-page story about murdered schoolgirl Milly Dowler.

"That's why you need to have the full context of their relationship; because while she was away, she was in contact with him, we say," said Mr Edis.

"Of course, what I've told you may mean that they had all sorts of personal reasons for wanting to remain in contact with each other but we say to you that it's clear from the timing of the contact that it was at least partly work-related."

Ms Brooks, 45, of Churchill, Oxfordshire; Mr Coulson, also 45, from Charing in Kent; former NotW head of news Ian Edmondson, 44, from Raynes Park, south west London; and the tabloid's ex-managing editor Stuart Kuttner, 73, from Woodford Green, Essex, all deny conspiring with others to hack phones between October 3, 2000, and August 9, 2006.

The jury has already been told that private investigator Glenn Mulcaire, who was paid around £100,000 per year, has admitted phone hacking.

Prosecutors claim Mr Mulcaire, Ms Brooks, Mr Coulson and Mr Kuttner were involved in a conspiracy to hack Milly Dowler's voicemail.

The prosecutor said her family went through an "agony of hope" as they "yearned for their missing daughter" for months until her body was found in the autumn of 2002.

"We say Mr Mulcaire did the hacking and Mrs Brooks, Mr Coulson and Mr Kuttner - not Mr Edmondson, he wasn't around at that time - were criminally involved in the conspiracy which resulted from that phone hacking," said Mr Edis.

Jurors were taken through a timeline of events that led up to a story that came from a hacked voicemail message on Milly's phone, including phone calls from Ms Brooks to the NotW newsdesk.

The court also heard that Ms Brooks told Eimear Cook, former wife of Scottish golfer Colin Montgomerie, that phone hacking had been used for a story about ex-Beatle Sir Paul McCartney.

"She said all you needed was a person's mobile phone number and a factory pin and you could listen to their voicemail and actually gave an example of a story involving Sir Paul McCartney and Heather Mills," Mr Edis told the jury.

He said there was evidence Sir Paul and his then wife had been targets of phone hacking by Mulcaire, resulting in a 2002 story about the former Beatle throwing his now former wife's ring out of a window. The trial continues.