Award-winning actor Sir Ian McKellen wowed pupils at a city school when he joined them for the unveiling of their mission statement designed to encourage equality.

The Lord of the Rings star, who co-founded Stonewall, the lesbian, gay and bisexual equality charity, was the guest of honour at Townsend Church of England School in St Albans.

The school’s new “Respect for all” ethos refers specifically to not abusing anyone because of their gender or sexual orientation, as part of a drive to tackle homophobic, biphobic or transphobic bullying.

The knighted thespian, who has championed the LGBT community since the 1980s, spoke to pupils about his own struggle against prejudice and discrimination and congratulated the school on their “inspiring” stance on respect and tolerance.

He said: “Townsend’s updated vow to support students and staff of any sexual orientation, as well as religious or ethnic background, was an important stepping-stone in our quest for social acceptance.

“I am honoured to unveil the new line, which empowers students to tackle any discrimination on grounds of gender or sexual orientation.”

Sir Ian also performed a monologue on the themes of tolerance and community from the Elizabethan play, Sir Thomas More.

Head teacher Andrew Wellbeloved said the new policy was “at the very heart” of the school’s beliefs.

He added: “This change in our policy is very significant and meaningful to the school and all of its partnerships.”