Rebekah Brooks texted Tony Blair that she was "feeling properly terrified" as she prepared for a grilling by police, the hacking trial heard today.
The ex-News International (NI) chief executive engaged in a flurry of texts with the former prime minister in the days leading up to her arrest on Sunday July 17 2011.
Earlier that week, Brooks had resigned, and she was preparing to appear before a Commons committee the following week.
Prosecutor Andrew Edis QC read out the messages around the subject of Mr Blair giving advice on her forthcoming appearance before the Culture Media and Sport Committee.
The exchange starts on July 10 with Mr Blair opening with: "Hi it's Tony."
They make arrangements to speak by phone the following day, and Brooks says: "Can't wait xx."
Earlier in the trial, the jury heard that Mr Blair gave Brooks words of comfort in the phone call and offered to be an unofficial adviser.
On July 15, the day of her resignation, Mr Blair texts: "I'm really sorry about it all. Call me if you need to. T x."
The next day, he texts: "If you're still going to Parliament you should call me. I have experience of these things! T x."
Brooks replied : "Definitely. Depends on the police interview first. I have Stephen Parkinson here today. I have never met him but people say he is good."
Mr Blair texts: "He's excellent."
Brooks replies: "Great news. Feeling properly terrified. Police are behaving so badly."
Mr Blair tells her: "Everyone panics in these situations and they will feel they have their reputations to recover. Assume you have quality QC advice?"
Later, he texts: "I'm no use on police stuff but call me after that because I may be some help on Commons."
Brook replies: "Great. Will do. X."
In her final text to Mr Blair, on the day of her arrest, Brooks told him: "With Stephen now. We are both saying hello. x."
The jury was shown more texts that Brooks sent to other people in the two days before her arrest, discussing her preparations for the police interview and appearance before the Culture, Media and Sport Committee (CMS).
In one, she reveals that Rupert and James Murdoch were coming to Oxfordshire for a lawyers' briefing. In another text, she says she needs to "keep focused and tight lipped".
She texted "James M" on July 16: "The police now want to arrest me tomorrow in the full glare of publicity as I have resigned.
"Lawyers trying to fight that but it could mean I don't do CMS. Will keep all in the loop once we know. Hear krm (Rupert Murdoch) was brilliant with the Dowler family."
The court also heard NI was planning to ask Lord Mandelson to "coach" Brooks for her appearance before the Commons committee.
Earlier today, Brooks spoke of her husband's attempt to hide embarrassing property from police.
Among items stashed in the underground car park of their London flat were lesbian porn DVDs, two laptops and a conker, the jury was previously told.
Brooks said: "He told me he had asked security to look after his belongings. I thought it was an impulsive ill thought-out decision. I thought it was a really, really stupid thing to do."
Mr Edis finished his cross-examination by dismissing Brooks's evidence.
He said nothing happened which she did not want to happen while she was "the boss", controlling staff, and even her husband Charlie.
He said: "In fact, Mrs Brooks, your evidence has been a carefully presented script."
Brooks, 45, of Churchill, Oxfordshire, gave evidence for 13 days at the Old Bailey.
She denies conspiring to hack phones, conspiring to commit misconduct in a public office and conspiring to pervert the course of justice. All seven defendants in the case deny the charges against them.
The trial was adjourned until 10am tomorrow.