Sir Ian McKellen has given students at Chew Valley School in Bristol a day they’ll never forget, after he delivered one of his most famous Lord of the Rings lines to ensure they kept up their studies.

Ian McKellenThe great Ian McKellen

The 74 year old was filmed telling a crowd of waiting students outside his window, “In your preparation for your examinations, if you don’t do your revision properly, YOU SHALL NOT PASS!”.

The actor delivered the famous line with the full vigour of Gandalf the great, much to the delight of the cheering Bristol schoolchildren.

Watch Ian McKellen quote Gandalf to bristol students

“It is a day that they and I will never forget,” said head teacher, Mark Mallett. “Sir Ian was a gracious guest at the school and an impassioned evangelist for tolerance and equality. I can think of no better creed for our young people to take from their school careers into their lives as citizens as they go from here to contribute to the future of our society and country.”

McKellen was a guest at the school to discuss LGBT issues on behalf of the charity StoneWall, which he co-founded in 1989. The charity is the largest gay equality organisation in Europe.

More: Sir Ian McKellen Joins 27 Nobel Laureates In Open Letter To President Vladimir Putin Protesting Russia's Anti-Gay Law

In honour of his charity work McKellen will received the ‘keys to the City of London’ later this year. In June the actor was also awarded a honorary doctorate from St Catherine’s college in Cambridge, the college celebrated McKellen's achievement by flying the rainbow flag in support of the actor's work for LGBT rights.