Matthew Parris, the journalist and political commentator, says he wishes he had come out as gay while he was a Tory MP in the 1980s.

Speaking to Total Politics magazine, the Times writer said he believed he “could have got away with it” at a time when gay politicians were considered scandalous.

He said: “There were years until which I wasn’t open because I judged I would never get into politics and I wouldn’t have and I wouldn’t have been selected.

“I wish now that I had come out when I was a Conservative MP. I think I could have got away with it in retrospect, but I think it would have been a close run thing. I had the nicest constituency and the nicest association and it would have given them an awful shock.

“A lot of them, I’m sure, had their doubts already and I think I could have ridden the storm. I so much admire [former culture secretary] Chris Smith for taking the risk.”

Parris was Tory MP for West Derbyshire from 1979 to 1986 and was an aide to Mrs Thatcher while she was Leader of the Opposition.

He has been reported as saying that he did mention being gay during a late-night Commons debate in 1984, but nobody noticed.

However, when he commented on Peter Mandelson’s sexuality on BBC Newsnight in 1998 – ten years after the peer was outed by the News of the World – he caused a storm and was sacked from his job as a Sun columnist.

The BBC then banned all mention of Mandelson’s sexuality and the clip itself was not broadcast until this month.

Parris told Total Politics interviewer Iain Dale he had “nearly forgiven” Mandelson for the incident.

He said: “I do think he made the most tremendous hoo-ha about it and I don’t think the BBC would have been so silly unless they thought Peter wanted them to.”

But he added that gay men in the public eye should come out fully, rather than attempting to keep their sexual orientations private.

He said: “[Not coming out fully] really whets the media’s appetite. Either you stay right in the closet, or if you’ve edged a little way out, for God’s sake come all the way out quickly.

“There is no status, although Peter Mandelson hoped there would be, in your homosexuality, as Peter puts it, being ‘private but not secret’. It’s public or its nothing.”

Parris added that Margaret Thatcher knew he was gay.

He said: “I told her I was gay when I went to say goodbye to her and she put an arm on my wrist and said, ‘Matthew that must have been very difficult for you to say’. She meant it kindly.”

When asked to reveal something unknown about himself, Parris, who recently earned himself a scolding from authorities for swimming across the Thames, claimed he had a “rudimentary third testicle”.

When Dale asked what “rudimentary” meant, he replied: “It never completely formed. Apparently it’s not uncommon!”

The full interview is in the latest issue of Total Politics, out now. It is also available online.