The award-winning actor, perhaps most known these days for his roles in box office hits Lord of the Rings and X-Men, delivered the Chancellor's Lecture at the University of Ulster's Magee campus.
Sunday's event saw him recall his great-great grandfather James McKellen, whom he likened firebrand preacher and former First Minister Ian Paisley as a "strict, evangelical Protestant minister in Ballymena".
McKellen told the audience that his roots had shaped much of his childhood.
"In puritanical Ballymena, it is said the park keepers used to tie up the children's swings on Sundays to keep the Lord's Day holy," he said.
"In the same spirit, at our home when I was a kid, we weren't allowed to play cards, nor board games on Sundays. No snap, Ludo or even jigsaws.
"Nor was I ever allowed to have a Wall's ice-cream, before or after Sunday school."
But Sir Ian paid tribute to Ballymena for having nurtured the likes of Ian Paisley, James Nesbitt and Liam Neeson - who was last week honoured there with the Freedom of the Borough.
Nesbitt - as Sir Ian's co-star in The Hobbit and Chancellor of the University of Ulster - was delighted to award the honorary degree and to have McKellen deliver the Chancellor's Lecture.
He told UTV that it was an honour to have his "great friend" accept the university's invitation and added: "He's been a real inspiration to all of us in The Hobbit - he's a very generous actor, talented beyond one's wildest imagination."
Sir Ian himself told UTV how it was down to Nesbitt that he was there in the first place and added that he was "thrilled" to be in Derry for the first time.
We were sitting on a mountainside in Middle Earth, James Nesbitt and me - and when he casually mentioned that he was Chancellor, I didn’t quite believe it ...
Sir Ian McKellen
Under the topic of Acting and Activism, the 73-year-old - who is openly gay - took the opportunity to discuss gay rights, including the significance of receiving a knighthood from the Queen in 1991.
He said he had viewed that honour as "a tiny suggestion that the political establishment was giving in to the idea that gay men could, despite the laws that disadvantaged us, be honourable and responsible citizens".
Sunday marked the first occasion that the annual Chancellor's Lecture has been held outside of Belfast - a decision taken given Derry's status as the UK City of Culture 2013.
University Vice Chancellor Professor Richard Barnett said it was a great coup that the star had agreed to appear and hailed him as "a man of deep personal conscience".
He added: "He is known as a voice of liberty. And he is known for his attention to the everyday matters of human courtesy, respect and loyalty - all evident in his acting.
"We are delighted to be able to honour him today at our Magee campus and to have him deliver the annual Chancellor's Lecture for the first time in the UK City of Culture."