The former editor of the Sun Rebekah Brooks sent David Cameron a text message saying "we're in this together" the night before Mr Cameron was due to make a key speech.
The message was revealed during the prime minister's appearance at the Leveson inquiry, where he was giving
evidence on the relationship between politicians and the press.
The inquiry heard that links between Mrs Brooks and the prime minister developed during Mr Cameron's time as leader of the Tory party in opposition during 2005-10.
The evening before Mr Cameron was speaking at the 2009 Tory party conference, Mrs Brooks sent him a message of support, describing herself as a "proud friend" and concluding "Speech of your life? Yes he Cam."
The close ties between politicians like Mr Cameron and journalists such as Rebekah Brooks is one of the key focuses of the Leveson inquiry.
Mrs Brooks has recently been charged with conspiring to pervert the course of justice as part of the police's investigation into the phone-hacking scandal.
The text message in full reads as follows:
"...But seriously I do understand the issue with the Times. Let's discuss over country supper soon. On the party it was because I had asked a number of NI [News International] people to Manchester post endorsement and they were disappointed not to see you. But as always Sam[antha Cameron] was wonderful (and I thought it was OE's [Old Etonians] were charm personfied!) I am so rooting for you tomorrow not just as a proud friend but because professionally we're definitely in this together! Speech of your life? Yes he Cam."
'I never made any deals'
The inquiry heard that during the period 2005-10, David Cameron met representatives from Rupert Murdoch's News Corporation on a number of occasions, including Rebekah Brooks.
He met with Rupert Murdoch 10 times, James Murdoch 15 times and Rebekah Brooks 19 times.
But Mr Cameron told the inquiry he did not accept the suggestion he did deals with media owners such as Rupert Murdoch to win their support.
"I don't believe in this theory there was a nod and a wink and some sort of agreement," the prime minister stated. "Of course I wanted to win over newspapers... but I didn't do it on the basis of saying overtly or covertly that 'your support will give you a better [position] on this policy or that policy'."
The prime minister admitted that he made a "controversial appointment" in choosing the former News of the World editor Andy Coulson to be his director of communications. He explained this was "controversial for two reasons. One was that bad things happened at the News of the World while he was editor [the hacking of mobile phones belonging to the royal family] and he resigned ... the second reason there was controversy is that this was a tabloid editor. There are some people who would say don't have a tabloid editor."
He conceded that the appointment "has come back to haunt both [Andy Coulson] and me", adding: "Some people just didn't approve of what the News of the World or what tabloids do. Quite aggressive articles sometimes. Andy Coulson came up with the most effective and destructive headline about me ever, three words which I never uttered: 'Hug a Hoodie'."
'A cathartic moment'
Mr Cameron described the inquiry as "a cathartic moment" and "a chance to reset relations between press, politicians and the police."
He admitted that the relationship between the press and politicians had turned "bad" and was "too close and unhealthy", but insisted there was a lack of trust on both sides.
"A lot of politicians think the press always get it wrong," the prime minister suggested, while the press think
politicians "are just out for themselves".
"It's become a bad relationship. How we get it to a better place, I think part of it will be about transparency, better regulation, having a bit more distance, that will be part of respect.
"But respect has to come from high standards in both places... respect has to be earned on both sides."
No 'inappropriate conversations'
On the subject of News Corporation's wish to take over BSkyB, Mr Cameron said: "I don't think you should stand in the way of corporate moves unless there's a public interest against it." But he acknowledged that the bid had been seen as a "political hot potato" and that "half of the Tory press was against it".
Mr Cameron stated he was confident that he had no "inappropriate conversations" with James Murdoch and Rebekah Brooks in November or December 2010 - the period when News Corporation's BSkyB bid was being discussed and reviewed.
Regarding the transfer of responsibility for the BSkyB bid from Vince Cable to Jeremy Hunt, Mr Cameron said: "We had to make the decision relatively rapidly but it was not some rushed, botched, political decision." He added: "If anyone had told me that Jeremy Hunt couldn't do the job, I wouldn't have given him the job."
But the prime minister said he could not recall the existence of Jeremy Hunt's memo of 19 November 2010 which supported the BSkyB bid. Regarding Mr Hunt's views in general, he said "I don't know that I did know [what his views were]. It was not high up on my list of issues."
Other points to emerge from the prime minister's evidence:
- Mr Cameron listed six journalists he described as "close friends": three who work on the Times, two for the Economist, and one for the Daily Mail.
- Television is the "most important method" of communicating with the public, according to Mr Cameron, rather than newspapers.
- A 24-hour news agenda means newspapers have been forced to "turn up the volume" on their coverage, said Mr Cameron, with a focus on "finding an angle" rather than simply reporting facts.
- He described Gordon Brown's belief that he and the Tory party did deals with Rupert Murdoch and News Corporaton as a "an unjustified conspiracy theory" and "complete nonsense".
- Nick Clegg expressed concerns to David Cameron about the appointment of Andy Coulson following the formation of the Tory-Lib Dem coalition in May 2010. "One or two" Tories also expressed concern to Mr Cameron, but he could not remember "exactly who and when".
- Changes have been made to the role of special advisers within the government, Mr Cameron outlined. Special advisers are now told that they work for the government, not a minister. Changes are also planned for the ministerial code of conduct.
'A hot potato'
"I'm sorry I've given you this hot potato," Cameron said to Lord Justice Leveson at one point. "I don't think you sound sorry for giving it to me at all," the judge replied.
Towards the end of the day, Lord Leveson urged Mr Cameron to ensure there is broad political support for his recommendations, a statement with which the prime minister agreed.
The inquiry will hear evidence from further witnesses later this month.