Tommy Sheridan confessed at a Scottish Socialist Party meeting to twice visiting swingers clubs, a jury heard.
Tommy Sheridan and wife Gail arrive at court for the case
Allan Green, the SSP's national secretary, told the Court of Session the Glasgow MSP had described his behaviour as "reckless" and apologised.
He said Mr Sheridan told the emergency meeting he wanted to deny the story, printed in the News Of The World.
The former SSP leader has launched a £200,000 defamation action over claims made about his sex life by a newspaper.
The emergency party meeting was held on 9 November, 2004, days after the newspaper published claims about an unnamed Holyrood politician.
Mr Green, 48, said: "Tommy referred to the News Of The World newspaper article.
"He said that he had visited a swingers club on two occasions, I think, in 1996 and 2002.
"He said he accepted his behaviour was reckless and he apologised to the executive committee for it."
Michael Jones QC, representing the newspaper, asked what the reaction was to the revelation.
Mr Green said: "Everyone was absolutely shocked."
The secondary school teacher said problems arose as to how the matter would be handled.
He said Mr Sheridan had accepted the claims were true but "he wanted to prove the story was false".
'Course of action'
Mr Green said everyone was acutely aware of the damage the story would do to the party, which in the eyes of the media and the public was firmly associated with Mr Sheridan.
He added: "Nobody at the meeting favoured Tommy's course of action."
Mr Green said Mr Sheridan was a tremendous ambassador and any blow to the leader would be a huge setback to the party.
Under cross examination, he accused the Socialist MSP of betraying his party.
Mr Green was shown minutes of the executive committee meeting where, he said, the admissions were made.
Mr Sheridan said: "I put it to you the so-called minute is as genuine as a 10 bob note, isn't it?"
"No Tommy, you know it is true," said Mr Green.
The jury heard the SSP tried to keep the minutes confidential but had to surrender them after one of their leaders, Alan McCombes, was jailed for defying a court order to hand over the document.
'A shameful thing'
Mr Green said: "For you to turn round and accuse the likes of myself of monstrous frame-ups, for any other socialist, never mind one of your standing, it is an appalling thing to do.
"I can hardly believe you are doing this.
"You know that like yourself I have spent a lifetime - my entire adult life - to build up the socialist movement.
"I always carried out to the best of my ability what the party has asked me to do."
He added: "You can lie, accuse me of monstrous frame-ups, none of it the truth. For you to turn round and accuse me of monstrous frame-ups it is shameful Tommy, it is shameful."
Mr Sheridan told him the trial was used to histrionics.
He said: "It does not cut as much ice as you think."
Mr Green claimed that at a meeting of the SSP's national council on 28 May this year - while Mr McCombes was in Edinburgh's Saughton jail - Mr Sheridan urged the handover of the minutes.
He said the claim that the minutes were not a true record of what happened on 9 November, 2004 followed.
Mr Sheridan asked the witness why he had not taken steps to let him see the minutes, which record his shock admission, as he was not present at the meeting.
Mr Green replied: "You had asked me to shred the minutes or keep them confidential."
Also appearing on Wednesday was Richie Venton, the SSP's Glasgow regional organiser and national trade union organiser.
He said Mr Sheridan told the party executive he would deny the allegations.
He added: "It is one thing to lie to the News of the World, that is what they trade on, but it is another thing to lie to a court."
The case continues.