Media playback is unsupported on your device Media caption Rebekah Brooks' text to David Cameron: "We're definitely in this together"

Ex-News International executive Rebekah Brooks told the PM "professionally we're definitely in this together", after the Sun paper switched loyalty to his party, the Leveson Inquiry heard.

Mrs Brooks sent the text to David Cameron on the eve of his speech to the 2009 Conservative Party conference.

But Mr Cameron said ex-PM Gordon Brown's claims about a Tory deal with the company were "complete nonsense".

And he said hiring ex-News of the World editor Andy Coulson had "haunted" him.

Mr Coulson became Mr Cameron's communications chief after resigning from the paper when its royal editor Clive Goodman was jailed for phone hacking.

'Proud friend'

Mr Cameron said Mr Brown's claim - that the Tories agreed to cut funding for the BBC and media regulator Ofcom in return for political support from News International - had been made because he was "very angry and disappointed" at the Sun's decision to switch support from Labour ahead of the 2010 general election.

Questioned about the Murdochs, Rebekah Brooks, Andy Coulson and Jeremy Hunt, he looked "tense, edgy, uncomfortable and again and again said he couldn't recall events" Hunt appointment 'not botched'

Mr Cameron said the message from Mrs Brooks, dated October 2009 and submitted as part of his written evidence, was a reflection the Sun had the previous week decided to support the Conservatives.

Mrs Brooks said in the text to the then opposition leader: "I am so rooting for you tomorrow, not just as a proud friend but because professionally we're definitely in this together."

The text refers to how they should have a "country supper soon".

Despite the friendship, Mr Cameron said there had been "no overt deals", "no covert deals" and "no nods and winks" with the company.

He said he did have some conversations with editors in which he told them "we'd love a bit more support from your paper", but "not very often".

Legal advice

Speaking about Culture Secretary Jeremy Hunt's appointment to handle the bid by News International's parent company News Corporation to buy BSkyB, Mr Cameron said: "It was not some rushed, botched, political decision. If anyone had told me Jeremy Hunt couldn't do the job I wouldn't have given him the job."

He said he "definitely asked the cabinet secretary's [Sir Jeremy Heywood] view and my memory is that he sought legal advice."

The BSkyB bid was eventually abandoned in July 2011 amid outrage over the phone-hacking scandal.

Rebekah Brooks's message to David Cameron on eve of conference speech "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 was wonderful (and I thought it was OE's [Old Etonians] were charm personified!) "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".

The Conservatives have been accused of having a biased view in favour of the bid by News Corporation.

The prime minister's witness statement reveals he had 1,404 meetings with "media figures" - 26 a month on average - while in opposition between 2005 and 2010. Once in government, that fell to an average of about 13 a month.

In 2008 he took a trip to the Greek island of Santorini for a dinner with News International boss Rupert Murdoch because it was a chance to "build a relationship" with him.

When asked by Robert Jay QC, counsel for the inquiry into the culture, practice and ethics of the press, how frequently he had seen Mrs Brooks between 2008 and 2009 when he was at home in his constituency in Oxfordshire, Mr Cameron was not specific.

He replied: "Not every weekend... um, in 2008/09, I'd have to check, I might be able to go back and check but I don't think every weekend, I don't think most weekends."

'Controversial appointment'

When he returned to give evidence in the afternoon however he said he had more details, after checking his wife Samantha's diary.

It suggested the couple were "in the constituency" 23 weekends in 2009 and 15 in 2010, meaning "we probably did not see [the Brooks] more than once every six weeks".

Lord Justice Leveson replied: "The great value of wives, prime minister."

Image caption Charlie and Rebekah Brooks appeared in court on Wednesday

Mrs Brooks and her husband Charlie - who went to school with Mr Cameron - have both been charged with conspiracy to pervert the course of justice in relation to the phone-hacking scandal surrounding News of the World. Both deny wrongdoing.

The prime minister told the inquiry he accepted hiring Mr Coulson was "a controversial appointment" which had "come back to haunt both him and me".

However, Mr Cameron said had been given "assurances" at the time by Mr Coulson that he had no knowledge of phone hacking at the paper.

Earlier Mr Cameron said politicians "have to take care when you have personal friendships [with individuals in the media] but that can be done and I have done that".

Mr Cameron said the relationship between politicians and the media had deteriorated. "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."

BBC political editor Nick Robinson said some of the key moments in Mr Cameron's testimony were when he was asked about Mr Murdoch, Mrs Brooks and the Sun, saying his answers were often "terse" and that he looked "tense".

Meanwhile Mr Hunt, responding to a Parliamentary question, said the Leveson Inquiry has so far cost taxpayers £3.2 million, with the total cost for part one of the investigation expected to reach £5.6 million.