'The Hobbit': Ian McKellen Says Goodbye to Gandalf (Photo)

Peter Jackson Gandalf - H 2013
<p>Peter Jackson Gandalf - H 2013</p>
Peter Jackson posts a final photo with the English actor, who wraps up playing the role of the sage wizard in the third and final Hobbit film.

Goodbye, Gandalf.

Ian McKellen has played Gandalf, the wise wizard in Peter Jackson's Tolkien films, since The Lord of the Rings: The Fellowship of the Ring began filming in 1999.

But now the English actor has finally wrapped up his role as the iconic wizard, having completed work on the final film in Jackson's Hobbit trilogy, There and Back Again.

The director posted a photo of himself with McKellen on set in New Zealand.

PHOTOS: Elijah Wood in 'Hobbit' and 16 Other Cameos in Prequels, Reboots and Remakes

"Seconds ago we finished our last shot with Gandalf. The end of an incredible adventure that began in 1999. I'm feeling very sad right now," Jackson wrote.

McKellen, now 74, was 59 years old at the start of the first shoot for Fellowship.

The second installment in the Hobbit series -- which sees Bilbo Baggins (Martin Freeman), joining 13 dwarves on a quest to reclaim the Lonely Mountain from the dragon Smaug (voiced by Benedict Cumberbatch) -- will hit theaters on Dec. 13 via Warner Bros.

The final installment, There and Back Again, opens in theaters one year later, on Dec. 17, 2014.