Sir Ian McKellen returned to his school in Bolton to spread the message of the gay rights organisation Stonewall, and to offer some words of encouragement to the pupils of his alma mater.

The 76 year old acting legend recalled how hard it could be at school for people singled out as being different. He remembered his own experience of being gay at school, with the added difficulty of homosexuality being illegal at that time. He added that absolutely anybody could be picked on for being different for any reason at all, and encouraged pupils to celebrate those differences.

Sir Ian McKellenSir Ian McKellen returned to his former school to deliver a speech to the pupils

McKellen said “If the world is going to improve in the next 50 years as much as it has in the last 50, you’re going to have a great life.” He then delighted the school assembly with his famous Gandalf line from Lord of the Rings, “You shall not pass!”

More: Sir Ian McKellen jokes that Taylor Swift once threw him out of New York apartment

In another new interview with The Hollywood Reporter, the recent Mr. Holmes star implored gay actors to reveal their sexuality to the world in order to change the industry and make themselves happier.

“A closet's a really nasty place to live, you know? It's dirty, it's dusty, it's full of skeletons. You don't want it,” he explained. “Open that door — fling it wide and be yourself.” He also revealed that his career really began to take off in 1988, in the aftermath of coming out himself. Since then, he has also been a prominent spokesperson for LGBT rights and a co-founder of the lobbying group Stonewall.

“I had no idea this silly thing was a weight on my shoulders. Do you want to be a famous movie star who has love scenes with ladies and in private be an unhappy gay? There's no choice. Forget the career, dear. Go and do something else.”

More: Sir Ian McKellen and Derek Jacobi prepare to serve as grand marshals for New York City Pride parade