For years, Sir Ian McKellen watched his classical theatre contemporaries take to the big screen. Now, as he returns  as Gandalf in The Hobbit, James Mottram finds a man  who has more than made up for lost time.

Like any actor, Sir Ian McKellen has enjoyed a few turning points in his career.

But ask him to pinpoint the big one, and it's not playing the wizard Gandalf in Lord Of The Rings, nor the villainous Magneto in X-Men. It was starring as Richard III in the 1995 film version of the Shakespeare play. "If it hadn't been for me, the film wouldn't have been made," he says (he co-wrote the screenplay adaptation and was executive producer). "I think anyone who was looking would say, 'Oh, I see, this guy doesn't just shout in large theatres, he can pull it off on screen.' That gave people a lot of confidence that I could be in their films."

While this attracted Bryan Singer to cast him as a Nazi in hiding in 1998's Apt Pupil, and then the metal-manipulating Magneto in X-Men, it's not hard to imagine Peter Jackson also being impressed by McKellen's ability to bellow and rage on screen when it came to casting Gandalf. Sitting in a swanky London hotel, his hair grey and his eyes bright blue, McKellen remembers the start of his Tolkien journey like it was yesterday. "I got a phone call that said, 'There's a man from New Zealand who is going to direct The Lord Of The Rings.' I said, 'I've never read that.' Then they said, 'He wants to come round with his wife and show you some designs.'"

Jackson and his partner Fran Walsh couldn't even show McKellen a completed script at that point. In the end, he simply took it on trust "and it's one of the best jobs I've had". The first part of the LOTR trilogy, 2001's The Fellowship Of The Ring, saw McKellen nominated for an Oscar for Best Supporting Actor, adding to the Best Actor nod he got for playing Frankenstein director James Whale in the sublime Gods And Monsters three years earlier. But playing Gandalf has been about more than just accolades. Suddenly, in the twilight of his career, McKellen is finally enjoying the success his peers have known.

"To be taken seriously by the film industry is very sweet and not taken for granted," he says. "I thought I never had ambitions to be in films, but my friends tell me I was always going on about why I didn't get parts in films when Albert Finney and Alan Bates and Tom Courtney and John Hurt and Anthony Hopkins were. But then it happened that I landed up in a classic. It's not something you can plan for. It just happens."

A "classic"? Try "phenomenon", with the LOTR trilogy garnering 17 Oscars and $2.9 billion at the global box office.

Now Jackson has returned to Middle Earth, the world devised by author JRR Tolkien, for The Hobbit, the 1937 book written 18 years before The Lord Of The Rings was published. Set six decades earlier than that adventure, The Hobbit sees McKellen reprise Gandalf, this time ushering Bilbo Baggins (played by Martin Freeman) on a dangerous journey to recover treasure from the Lonely Mountain.

"There's more detail in Gandalf this time," the actor says. "You see him being the politician around the table, assessing what's going on and making his point. In Lord Of The Rings he sits back and listens, but this time he's in the thick of it."

A good advert for the film, McKellen is wearing a black Hobbit sweatshirt – the one to mark the half-way point through the 200-day shoot. He claims his house is filled with Gandalf models, toys and merchandise he has been given. He has even been made into a Lego figure – surely the ultimate accolade for any actor. "The best one I've got is a nodding-head Gandalf," he laughs. "But I don't quite know what to do with them. Sometimes I club them all together and have a little Gandalf convention on the shelf! Sometimes I hide them. They've given me the hat – what the hell am I going to do with the hat?"

McKellen also claims there's more humour in The Hobbit: An Unexpected Journey, the first of three films that will flesh out Tolkien's earlier story. "Peter did sometimes say – not very helpfully: 'Be more funny!' He wanted Gandalf to be drunk at one point and I said, 'No, Gandalf doesn't drink!' I don't know why I was so certain that Gandalf doesn't drink."

It wasn't always a breeze slipping on the beard and cloak, either. After a decade of the character becoming entrenched in popular culture, "I had to be careful not to be a caricature. And sometimes Peter would say, 'Where's Gandalf?'"

The way McKellen talks, it seems as if his lifelong love for acting has remained undimmed. He began as a child, growing up in Wigan, encouraged by his parents and older sister Jean – who took him to his first Shakespeare play, Twelfth Night.

His theatre credentials are unparalleled – from acting at Cambridge, he went on to London to become a member of Laurence Olivier's National Theatre Company at the Old Vic by 1965, followed by two decades as a leading player in the Royal Shakespeare Company and at the National. So, is he still passionate for the craft?

"Well, is my passion for life as strong as it was?" he counters. "At 73, there isn't a day when you don't think about death. You don't necessarily talk about it, except to other 73-year-olds. Things start going wrong. You can't remember - you see your friends having difficulty walking. You think, 'Jesus, it's going to happen to me soon.' So, if anything, I think, 'I don't have long left so I better work while I can.' Then you think, 'Do I really want to go out to work today?'"

Next year, he will reunite with Singer to put on Magneto's helmet again for X-Men: Days Of Future Past, though you get the impression he'd be just as happy to stay in London. "To wake up on a sunny day in my own home – I have a lovely home – and to look in the diary and there's nothing in it and think, 'I'll stay in bed for another half hour!' – wonderful! I'll invite somebody around, I go out, I won't go out, I'll pick up a book that I've been meaning to look at. It's a happy state to be in."

Recently, he's been spending his spare time visiting schools in the UK talking to pupils about being gay. Knighted in 1991, McKellen famously came out three years earlier, shortly before he played that "raging heterosexual" MP, John Profumo, in the film Scandal. He is a co-founder of Stonewall, the lesbian, gay and bisexual lobby group, and it is with them that he's recently been touring schools. "They help teachers understand their responsibilities to gay students and gay members of staff. So, to schools that have turned themselves around and are tackling bullying against gay students, for example, I go along and support those efforts."

While the theatre community had known of McKellen's sexuality for years – he spent 10 years with theatre director Sean Mathias, before their relationship came to an end in 1988 – he marvels at how attitudes have changed. "In my lifetime, we've moved from a situation where it was illegal to make love – I had friends put in prison for it – to the almost certainty that in two years you'll be able to get married to someone of the same gender. In 40 years, that's quite a big improvement."

Even so, there is still reluctance among actors to come out, for fear it might affect their careers or the type of roles they will get. Does he ever encourage co-stars to come out? He looks a little taken aback at the idea. "I don't go up to them and say, 'Come on, what about it?'" he says. "But I know it's the best thing you can possibly do, to be honest. Because your life will utterly, completely change for the better. So why wouldn't I encourage other people to come out? I do. And I think in my case my acting improved. Everything improved about my life."

These days, he estimates that being gay is no big issue, that people "just take it in their stride". He compares it to this year's Paralympics (which he helped open, playing Shakespeare's Prospero). Even on public transport, he says, he's seen people with their prosthetic limbs showing. "They always covered them up before – I'd never seen them. Well, now people are proud to be disabled. Why not? Proud of their ability to be mobile. They've come out. They've been allowed to come out.

"If you're gay, you can hide. And if you're disabled, you can hide. But better not to. Variety is the spice of life. Why do we all want to be the same?"

The Hobbit: An Unexpected Journey opens in UK cinemas on Thursday