<P> He appeared in the modestly acclaimed film Apt Pupil, which was directed by Bryan Singer and based on a story by Stephen King . McKellen portrayed a fugitive Nazi officer, living under a false name in the US, who is befriended by a curious teenager (Brad Renfro) who threatens to expose him unless he tells his story in detail . He was subsequently nominated for the Academy Award for Best Actor for his role in the 1998 film Gods and Monsters, wherein he played James Whale, the director of Show Boat (1936) and Frankenstein . </P> <P> In 1999 McKellen was cast, again under the direction of Bryan Singer, to play the comic book supervillain Magneto in the 2000 film X-Men and its sequels X2: X-Men United (2003) and X-Men: The Last Stand (2006). He later made a short appearance as an older Magneto in 2014's X-Men: Days of Future Past; sharing the role with Michael Fassbender, who played a younger version of the character in 2011's X-Men: First Class . </P> <P> While filming the first X-Men film in 1999, McKellen was cast as the wizard Gandalf in Peter Jackson's three - film adaptation of The Lord of the Rings (consisting of The Fellowship of the Ring (2001), The Two Towers (2002), and The Return of the King (2003)). He received honors from the Screen Actors Guild for Best Supporting Actor in a Motion Picture for his work in The Fellowship of the Ring, and was nominated for the Academy Award for Best Supporting Actor for the same role . He provided the voice of Gandalf for several video game adaptations of the Lord of the Rings films, then reprised the role on screen in Jackson's film adaptation of The Hobbit, which was released in three parts from 2012 to 2014 . </P> <P> On 16 March 2002, he hosted Saturday Night Live . In 2003, McKellen made a guest appearance as himself on the American cartoon show The Simpsons, in a special British - themed episode entitled "The Regina Monologues", along with the then UK Prime Minister Tony Blair and author J.K. Rowling . In April and May 2005, he played the role of Mel Hutchwright in Granada Television's long running British soap opera, Coronation Street, fulfilling a lifelong ambition . He narrated Richard Bell's film Eighteen, as a grandfather who leaves his World War II memoirs on audio - cassette for his teenage grandson . </P>

Who played the wizard in lord of the rings
find me the text answering this question