Proceeds from his run at the 2019 Edinburgh International Festival were donated to Leith Academy for a revamp of its drama studio.
New retractable seating has been installed in the facility, which is used for performances, as well as lessons, parents’ evenings and assemblies.
The 81-year-old has a long-standing relationship with the festival since his breakthrough performances in two shows at the Assembly Hall in 1969, playing the lead roles in Edward ll and Richard ll.
He has pledged to try to up an invites “soon” for a visit to Leith Academy, which has had its three-year partnership with the EIF extended due to the impact of the coronavirus pandemic over the last 12 months, when most workshops had to be delivered online.
The Leith Academy project, announced in 2018 following completion of a previous partnership with Castlebrae Community High in Craigmillar.
It has involved a mentoring programme partnering festival staff with students, behind-the-scenes insights into set-building, costume maintenance, stage management, and sound and light design, the creation of personal development awards, a team of “festival ambassadors” and an artists-in-residence scheme.
The EIF said the extension of the partnership would allow it to coincide with the 75th anniversary of the event.
Headteacher Mike Irving said: “As a school and as a community we are delighted to accept this wonderful gift from Sir Ian McKellen, whose outstanding work is an inspiration to us all.
“I look forward to the presentations and performances that can be viewed from the new seating and I sincerely hope that one day Sir Ian accepts my open invite to Leith Academy and can be part of a crowd enjoying a performance from our many talented young people.
"Young people and staff thrived over the first two years of our Edinburgh International Festival residency, so I’m delighted that we have adjusted our terms to extend the residency by a further year.
“The innovative and exciting work the Edinburgh International Festival team brings to the table is an inspiration to our young people and staff.”
Sir Ian, one of the biggest names to perform at the EIF two years ago, said: “I’m so pleased that income from my show at the 2019 Edinburgh International Festival was sufficient to install a seating bank for Leith Academy's drama studio.
"May the pupils enjoy performing in their academy’s wonderfully versatile space. May audiences enjoy watching them. I hope one day soon I may be among them, to try out the new seating.”
Donald Wilson, culture convener at the city council, said: “It’s great to see the proceeds from Sir Ian McKellen’s Edinburgh International Festival shows being used to build this new seating bank in Leith Academy.
“I’m sure there literally won’t be a seat to spare when the school puts on performances again which we all hope will be very soon.
"This inspiring partnership with the Edinburgh International Festival continues to provide unforgettable artistic opportunities for our young people – long may it continue.”