Ricky Martin has said he spent years avoiding even platonic relationships because he feared people would find out he was gay.

The singer and actor, 46, officially came out in 2010 after years of speculation about his sexuality.

He told Attitude magazine that before then he completely “submitted” himself to his career.

“I didn’t open doors to new relationships, and I’m not talking about romantic relationships, I’m talking about any relationship, because I didn’t want people to know me too much,” he said.

“I wouldn’t even sit down and have a cool relationship with amazing producers or great film directors because I was afraid that if they spent more than two hours sitting with me they would know my nature.

“I wasted so much energy trying to manipulate my sexuality.”

Ricky Martin on Attitude
Ricky Martin on Attitude (Tony Duran/PA)

Martin recently played late designer Gianni Versace’s partner Antonio D’Amico in The Assassination Of Gianni Versace: American Crime Story.

He said his own experience of being a closeted gay man in the public eye fed into his performance in the 90s-set show.

“The level of injustice that we as a community were dealing with back then was heavy,” he said.

“I played every role before I even started working on this project.

“I was a closeted gay man who was making my partners hide.

“I had relationships with other men who were in the closet and I had other relationships with men who were not in the closet but because of me went back into the closet.

“And so I’m reliving everything that I did.”

The singer is now married to husband Jwan Josef and has twin sons, and is thrilled to be inspiring other gay men.

“We love it!” he said.

“It’s not even for us; it’s for our kids. It’s for my kids to look at us on that red carpet and say, ‘Ah, those are my daddies, how cool!’

“And to boost my children with self-esteem and let them understand how amazing it is to be part of a modern family … We know that we carry this flag and if we’re going to carry this flag, let’s sway this flag really loudly.”

Martin appears on the cover of the new issue of Attitude, which is available in print and online from March 29.