Ian McKellen promoting Mr. Holmes
Ian McKellen's latest film sees him portray an ageing Sherlock HolmesJohn McDougall/Getty

During Pride Month for the LGBT community and ahead of him receiving the Trevor Project's Trevor Hero Award on 15 June, Sir Ian McKellen has admitted that he "regrets [not] coming out much earlier" as he believes it made him a better actor.

Talking to The Huffington Post, the 76-year-old confessed that he thinks he "would have been a different person and a happier one" if he had been more open about his sexuality when he was younger instead of being ashamed of who he was.

McKellen officially came out to the public in 1988 when he was 49, prompted by the controversy at the time surrounding the Section 28 legislation that prevented local authorities from promoting homosexuality.

"I think up to that point, I had been using acting as a disguise – somewhere I could express my emotions, and draw attention to myself in a way that I didn't particularly want to do in real life," he said in the interview.

"Acting became not about disguise, but about telling the truth. And my emotions became much freer. I was able to act better as I think you are able to do any job. Everyone's better if they're being honest."

The Vicious star went on to say that "self-confidence is the most important thing that anybody can have" and urged people that "you don't have that if part of you is ashamed or hiding something.

"I can reassure people who don't feel they're able to, the world will like you better because people like honesty and authenticity."

The Hobbit: The Battle of the Five Armies
McKellen is best-known particularly among younger audiences for portraying Gandalf The Grey in both The Lord Of The Rings and The Hobbit franchisesWarner Bros

Since making his sexuality known, the Oscar-nominator actor has become a prominent activist for gay rights and hopes to inspire others to be themselves.

Back in February 2014, during a BuzzFeed Brews interview, the Lord Of The Rings star said: "For people who are lonely ... reading that about someone whose career they follow is a little bit of a help and encouragement to them to think it does get better."

Just before that interview was conducted, his X-Men co-star Ellen Page (who plays Kitty Pryde within the franchise) had recently come out, which McKellen said "gladdened [his] heart so much".

McKellen's latest movie about fictional character Sherlock Holmes has him portraying a very different version of the iconic detective than audiences have come to expect, but taking on a wide variety of roles is important to the well-known actor who was keen not to be typecast.

"I didn't turn myself into a queer actor, which I think a lot of people rather expected I ought to do or that was my new responsibility.

"I find heterosexuality far too interesting a phenomenon to avoid! Macbeth isn't gay nor is Richard III, or King Lear. I didn't want to cut myself off from all those things."

Mr. Holmes is released in the UK on 19 June.