The 73-year-old British Lord of the Rings actor admits that he was in the closet for many years when he was a young man.
UK newspaper The Telegraph reports that Ian is very supportive of being open about sexuality.
Ian encouraged pupils at Acland Burleigh school in North London to express themselves.
“There was no Graham Norton on the television at that time, no gay MPs, no-one talking about gay rights on the radio. So I dealt with it my trying to cut that part of myself off, to hide myself, to choke a part of me,” he explained during a speech to students.
“When you are made to feel you are so wrong for being who you are, that’s what you do. I think that’s why so many great British actors are gay – we spent so long pretending to be straight, to be someone else, that eventually we became very good at it.
“I wish that every child, every teacher, every person in this room can be free to be who they are, whatever their sexual orientation”.
The news that Sir Ian struggled with his sexuality comes as a new sitcom has been commissioned by ITV, which will feature him and Sir Derek Jacobi as an elderly gay couple.
The series, which is titled, Vicious Old Queens, will feature both actors as an elderly gay couple living in London’s Covent Garden.
The series was written by Gary Janetti, a former executive producer and writer of Will and Grace and Family Guy, and consists of six thirty minute episodes, the Star on Sunday reported.