Steve Coogan has claimed at the Leveson inquiry that "lurid" details of his private life were revealed by the News of the World after he was set up in a "sociopathic sting" by former editor Andy Coulson and the paper's ex showbiz columnist.

The actor and comedian told Lord Justice Leveson at London's high court on Tuesday that Rav Singh, the former News of the World showbiz columnist, agreed not to publish explicit details about Coogan's extra-marital affair in April 2004 if he would confirm less salacious details.

"I begged him not to put in some of the more lurid details of the story, and he said if I confirmed certain aspects of the story in return he would guarantee that the more lurid details would be left out of the story," Coogan said.

"I confirmed certain details for him and he gave me his word that the more embarrassing part of the story which I knew would upset my then wife's family would be omitted."

However, Coogan then claimed that Coulson got in touch and said the NoW would publish all the details in the next Sunday's newspaper.

"After that my manager received a phone call from Coulson that they were going to put everything in the paper," Coogan said.

Coogan said that two years earlier he had received another phone call from Singh, who warned the actor he was about to be the subject of a NoW sting.

"[Singh told Coogan that] I was about to receive a phone call which would come from Andy Coulson's office," Coogan said. "There was a girl in Andy Coulson's office who was going to speak to me on the phone, the phone call would be recorded and she would try to entice me into talking about intimate details of her and my life."

Coogan said that Singh told him to purposefully "obfuscate" on the phone, because he knew that Coulson would allegedly be listening, and no story was published.

In just under two hours of testimony, Coogan told how his life had been laid bare by the tabloid newspapers over the years.

"My closet is empty of skeletons as a result of the press, so unwittingly they have made me immune in some ways," he said.

• To contact the MediaGuardian news desk email editor@mediaguardian.co.uk or phone 020 3353 3857. For all other inquiries please call the main Guardian switchboard on 020 3353 2000. If you are writing a comment for publication, please mark clearly "for publication".

• To get the latest media news to your desktop or mobile, follow MediaGuardian on Twitter and Facebook.

Sign up for the Guardian Today

Our editors' picks for the day's top news and commentary delivered to your inbox each morning.