Former News of the World editors Rebekah Brooks and Andy Coulson were having an affair for at least six years from the late 1990s, the phone-hacking trial has heard.
Prosecutor Andrew Edis QC said he was disclosing the affair because it showed how much the pair trusted each other.
"What Mr Coulson knew, Mrs Brooks knew too. What Mrs Brooks knew, Mr Coulson knew too," he said. "That's the point."
Mrs Brooks and Mr Coulson deny charges including conspiracy to phone hack.
Jurors heard their affair, which began around 1998, was discovered by police through a letter saved on a computer belonging to Mrs Brooks.
'I love you'
The letter was written by Mrs Brooks in February 2004, when Mr Coulson was trying to end the affair, Mr Edis said.
She 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."
It is not clear whether Mr Coulson ever received the letter, which was found on a Word document on a computer hidden in a cupboard.
Mr Edis told jurors he was not revealing the affair to deliberately intrude into the pair's privacy or to make a "moral judgment".
"But 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?," he said.
"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."
In other evidence, the court heard that Mr Coulson confronted former Home Secretary David Blunkett over his three-year relationship with a married woman.
Mr Coulson, then editor of the News of the World, told Mr Blunkett, who was not married at the time, that the story had come from "extremely reliable sources", which was in fact phone hacking, Mr Edis said.
In a recording played in court of a meeting in August 2004 between the two men, Mr Coulson told Mr Blunkett: "My job is to sort out the nonsense from the accurate.
"I believe if I don't do this story at least one of my sources will take this information to another newspaper. People talk."
The court heard a story about the affair was published later that same month.
Recordings of voicemails left on the married woman's phone included a message about a pregnancy scan, the court heard.
Mr Edis told jurors: "We say it is absolutely inconceivable that a newspaper would publish a story of that kind about a serving cabinet minister without knowing it was true.
"Mr Coulson did know it was true... because of the voicemails which had been obtained as a result of tasking Glenn Mulcaire, [a private investigator] who by August 2004 had been working regularly for the News of the World for four years."
The court also heard that the News of the World's then managing editor, Stuart Kuttner, had told police the paper had a tape of a voicemail left on the phone of murdered schoolgirl Milly Dowler, who went missing in Surrey in 2002.
Surrey Police took no action at the time, jurors heard.
Mr Edis said: "It is common ground that Surrey Police could and should have investigated. Perhaps at that time they may have thought that it was really more important to find Milly Dowler."
The court also heard that in the same week that the paper tried to get an interview with Mr and Mrs Dowler, Mulcaire was being asked to hack their daughter's phone.
Mr Edis said the paper's editors had extensive contact with each other and the police over the case, and Mrs Brooks was even making calls about Milly Dowler while on holiday in Dubai.
This, he said, proved she must have known what was going on.
The discovery that the schoolgirl's phone had been hacked by someone at the News of the World ultimately led to the closure of the Sunday tabloid in 2011.
The jury was told Mrs Brooks did know about the practice of phone hacking.
Mr Edis said she told golfer Colin Montgomerie's then wife, Eimear, in 2005, that all you needed to listen in to people's voicemails was a mobile number and a factory pin.
Mrs Brooks gave her an example of an exclusive story that she said had come from hacking, about Sir Paul McCartney arguing with his then wife Heather over an engagement ring, jurors heard.
Mrs Brooks, 45, of Churchill, Oxfordshire, and Mr Coulson, also 45, from Charing in Kent - among eight people on trial - are both accused of conspiring with others to hack phones and two counts of conspiring with others to commit misconduct in public office.
Mrs Brooks also faces two allegations of conspiracy to pervert the course of justice. They deny all charges.
Mrs Brooks married her first husband, actor Ross Kemp, in 2002, after a six-year engagement.
She married her second, the former racehorse trainer Charlie Brooks, in 2009. They have a young daughter.
Mrs Brooks took the helm at the News of the World in 2000, becoming the youngest editor of a British national newspaper, and went on to edit the Sun three years later. In 2009, she became chief executive of News International.
Mr Coulson married his wife Eloise in 2000. They have two children.
He was Mrs Brooks' deputy for three years during her editorship at the News of the World, then took over as her successor in 2003.
He quit in January 2007 and went on to become Prime Minister David Cameron's communications director until 2011.
Mr Kuttner, 73, of Woodford Green, Essex, also denies conspiring with others to hack phones between 3 October, 2000 and 9 August, 2006.
On Wednesday, the court was told Mulcaire, and three former News of the World journalists who are not on trial, had pleaded guilty to phone-hacking charges.
Earlier on Thursday, the court heard Mulcaire was given a written contract in 2001 and received 221 payments between 2000 and 2007, totalling £413,527, that were authorised by Mr Kuttner.
Mr Edis also told jurors how emails sent by Mulcaire about hacking phones belonging to MP Tessa Jowell and her husband, David Mills, Lord Frederick Windsor and an adviser to John Prescott led the police to launch their investigation in 2011.
Mulcaire was, said Mr Edis, a "quick worker" who knew how to get mobile phone operators to reset voicemail passwords - a method allegedly used to access people's voicemails.
The trial continues.