The Andy Coulson perjury trial has begun hearing evidence which the former News of the World editor gave at the 2010 perjury trial of Tommy Sheridan.
Mr Coulson, 47, was called as a witness and questioned by Mr Sheridan during the case. A tape of that exchange was played in court on Tuesday.
He is accused of lying when he told the jury he did not know one of the paper's journalists and a private investigator were involved in phone hacking.
Mr Coulson denies the charge.
In courtroom three at the High Court in Edinburgh, the jury of nine men and six women listened to a tape of Mr Coulson's evidence on 9 and 10 December 2010 at Mr Sheridan's perjury trial.
They heard Mr Coulson swearing an oath to tell the truth before confirming his job at the time: director of communications at Downing Street, answerable to the prime minister, a position he said could be described as a "spin doctor".
On the tape, Mr Coulson, who was editor of the News of the World from 2003 to 2007, said the first he had known that one of his journalists, Clive Goodman, had been involved in hacking the telephones of celebrities and members of the royal household was when Mr Goodman was arrested along with a private investigator, Glenn Mulcaire.
"I had no knowledge that he was doing these things," said Mr Coulson, who is from Preston in Kent.
Mr Coulson said he had not known Mr Mulcaire.
"I'd never met, heard of, emailed spoken to Glenn Mulcaire," prior to the Goodman affair, he said.
He said payments involving Mr Mulcaire were made "without my knowledge".
The former journalist also denied knowing about the News of the World making payments to corrupt police officers.
"I have no knowledge of it happening," he said.
Under cross-examination, a senior detective told the court there was no evidence that Mr Coulson and Mr Mulcaire ever exchanged emails.
The court later heard that Mr Coulson and members of the Royal Family had their phones hacked.
Det Con Richard Fitzgerald, 36, said the former editor was among thousands of people who had their mobile phone security compromised.
The officer was working on the Metropolitan Police's Operation Weeting investigation which was set up to look at claims that journalists at the News of the World were illegally intercepting voicemails.
He told the court the methods which people use to hack phones and said that officers found handwritten notes detailing the contents of intercepted voicemails.
The police officer also told the court that phone hackers also made tape recordings of voicemails.
The court also heard that Mr Goodman and Mr Mulcaire were both convicted of phone hacking offences and both received prison sentences.
Det Ch Insp Steve McCabe, 47, who is also based with the Met Police in London, told the court that Operation Weeting, which is still ongoing, established that phone hackers targeted celebrities, royals and people who had been the victims of crime.
When Mr Coulson's advocate Murdo MacLeod QC asked whether policemen looked at 90,000,000 emails during the phone hacking inquiry, Mr McCabe said: "90,000,000 doesn't sound unreasonable."
The charge against Mr Coulson alleges that he lied in court and that he did in fact know about phone hacking, did know or know of Glenn Mulcaire and did know about payments by the newspaper to corrupt police officers.
Mr Coulson, who sat in the dock wearing a grey suit and holding a transcript of his evidence, denies perjury.
The trial before Lord Burns is expected to last four weeks.