He went on: “In Government the job became different because you are doing things rather than just talking about things. My role was to work with the Civil Service communications departments as well as being a political adviser to the Prime Minister.”

The jury was told that Mr Coulson resigned from the job in January 2011, was arrested on suspicion of phone hacking that July and eventually charged in connection with the allegations the following summer.

Asked what contact he had had with the Prime Minister since then he said: “Immediately after my family and I spent a weekend with him, I think that was in the Spring.”

He said the invitation had been extended before he resigned and added: “I have not spoken to him since.”

Asked what contact, if any, he had had with Rupert Murdoch since his resignation as News of the World Editor in 2007, Mr Coulson said: “Sparingly, almost entirely at social events. I think his summer party, but there were also occasions, very few, when David Cameron met with Rupert Murdoch. While I did not sit in on those meetings, I saw him afterwards.”

After two years he joined The Sun as a showbusiness reporter before eventually being promoted to the paper’s Assistant Editor.

Following a stint in charge of News International’s digital arm, he was appointed News of the World deputy editor under Rebekah Brooks.

Mr Coulson said their appointment was not met with enthusiasm by all at the paper.

He said: “There was a view among some of the senior staff that we were just passing through.”

Asked by his barrister Timothy Langdale QC his views on Mrs Brooks’s editorship, he said: “Rebekah was a very good journalist, an editor who was very supportive of her staff, she worked very hard and during our time on the News of the World, she was very heavily involved in the campaigning side of the News of the World.”

Mr Coulson denies one count of conspiracy to intercept communications and two counts of conspiracy to commit misconduct in public office.