A former News Of The World journalist has told a perjury trial that he hacked voicemail messages while accused Andy Coulson was editor of the newspaper.

Clive Goodman, 57, told the High Court in Edinburgh that while employed as royal editor he came to know of a newsdesk contact who could "crack seemingly uncrackable stories very quickly".

The witness said he was later told "they had been hacking phones" and was himself given a list of numbers to use in order to get stories.

Mr Goodman, from Surrey, told the jury: "I would hear messages, voicemail messages."

This was going on in 2004 and 2005 when Coulson was editor of the newspaper based in Wapping, he said.

Advocate Depute Richard Goddard, prosecuting, asked him: "Did he know that you were accessing voicemails at that time?"

Mr Goodman said: "Not from me, no."

Asked "did that change in the months ahead", he replied: "Yes it did."

Coulson, 47, is accused of lying in court in the 2010 trial of former Socialist MSP Tommy Sheridan.

Prosecutors say he falsely stated he did not know about phone hacking at the News Of The World after being sworn in as a witness on December 9 and 10 that year.

The ex-Sunday newspaper editor, who went on to become director of communications at Downing Street, is accused of falsely stating he did not know that Mr Goodman was involved in intercepting voicemail messages before Mr Goodman's arrest on August 8, 2006.

He denies the charges.

The court heard that Mr Goodman began working directly in 2005 with private investigator Glenn Mulcaire, who had been the earlier contact of news editor Greg Miskiw.

He said Mr Mulcaire contacted him around October that year and was "complaining" that the newsdesk was cutting his budget by £500.

Mr Mulcaire suggested that, for £500 per week, Mr Goodman could provide names of people around the Royal Family and he would access their voicemails, the witness said.

He said Mr Mulcaire "explained to me how the system worked" and Mr Goodman told the court the proposal meant he would be able to "monitor this resource properly".

However, jurors heard, Mr Goodman was unable to raise that sum of money in his role as royal editor.

He said he wanted to take the newsdesk "out of the loop" and take the proposal to the editor directly.

Richard Goddard, prosecuting, said: "For the avoidance of any doubt, who was the editor?"

"That was Andy Coulson," he said.

Mr Goodman then told the court he took the proposal to Coulson in his office at the end of October 2005.

Mr Goddard asked him to tell the court what he remembered about the exchange.

He said he "outlined" the proposal from Mr Mulcaire and "what we might get from it".

When asked what Coulson's reaction was, Mr Goodman said: "He was worried about the cost, we agreed to it on a trial basis and would review after a month."

Mr Goodman said he handled the "mechanics" of the arrangement himself and he sent the money through under the fake name "Alexander".

He said they did not have a conversation about whether it was legal or not, and added: "I didn't know it was illegal."

The witness then told the court the arrangement was extended before it was agreed payment would only be for "results".

He said he was under an "enormous amount of pressure" at the paper and was "out of favour" with the editor.

The court was then shown an email allegedly sent from Coulson to senior executives at the paper saying they needed to "generate big hits" and would be "more and more reliant on home-grown material".

Mr Goodman, who joined the News of the World in 1986, said he got on well with Coulson - though they were not "great buddies" - but that changed when he became editor and a new deputy editor was appointed.

He told the court that working at the tabloid became "hyper-competitive" and news editor Ian Edmondson was dismissive of stories he put to him, telling Goodman "If it's not the big story, it's the Big Issue".

Mr Goodman said he was effectively demoted from his position as an assistant editor.

The witness said: "I'd gone from a position of effectively being my own boss to being put into the care of a boss who clearly resented me and rejected everything I came up with."

Asked what would happen if he did not come up with lots of stories during conference , he replied: "You'd be torn apart, pretty much, in front of everyone."