Gandalf is a fictional character in J. R. R. Tolkien’s novels The Hobbit and The Lord of the Rings. In these stories, Gandalf appears as a wizard, member and later the head (after Saruman’s betrayal and fall) of the order known as the Istari, as well as leader of the Fellowship of the Ring and the army of the West. In The Lord of the Rings, he is initially known as Gandalf the Grey, but after returning from death as Gandalf the White.
Tolkien discusses the characteristics of Gandalf in his essay on the Istari, which appears in the work Unfinished Tales. He describes Gandalf as the last of the wizards to appear in Middle-earth, one who: “seemed the least, less tall than the others, and in looks more aged, grey-haired and grey-clad, and leaning on a staff”. Yet the Elf Círdan who met him on arrival nevertheless considered him “the greatest spirit and the wisest” and gave him the elven Ring of power called Narya, the Ring of Fire, containing a “red” stone for his aid and comfort. Tolkien explicitly links Gandalf to the element Fire later in the same essay:
Warm and eager was his spirit (and it was enhanced by the ring Narya), for he was the Enemy of Sauron, opposing the fire that devours and wastes with the fire that kindles, and succours in wanhope and distress; but his joy, and his swift wrath, were veiled in garments grey as ash, so that only those that knew him well glimpsed the flame that was within. Merry he could be, and kindly to the young and simple, yet quick at times to sharp speech and the rebuking of folly; but he was not proud, and sought neither power nor praise… Mostly he journeyed unwearingly on foot, leaning on a staff, and so he was called among Men of the North Gandalf ‘the Elf of the Wand’. For they deemed him (though in error) to be of Elven-kind, since he would at times work wonders among them, loving especially the beauty of fire; and yet such marvels he wrought mostly for mirth and delight, and desired not that any should hold him in awe or take his counsels out of fear. … Yet it is said that in the ending of the task for which he came he suffered greatly, and was slain, and being sent back from death and was clothed then in white, and became a radiant flame (yet veiled still save in great need).
“The Quest of Erebor” in Unfinished Tales elaborates upon the story behind The Hobbit. It tells of a chance meeting between Gandalf and Thorin Oakenshield, Thráin’s son, in the inn of the Prancing Pony in Bree. Gandalf had for some time foreseen the coming war with Sauron, and knew that the North was especially vulnerable. If Rivendell were to be attacked, the dragon Smaug could cause great devastation. Thorin was also keen to regain his lost territory, and so the quest was born.
In T.A. 2941, Gandalf arranged (and frequently accompanied) a band of thirteen dwarves and the Hobbit Bilbo Baggins to reclaim from the dragon Smaug the Dwarves’ lost treasure in Erebor. To the quest, Gandalf contributed a map and key to Erebor. It was on this Quest of Erebor that Gandalf found his sword, Glamdring, in a troll’s treasure hoard, and that Bilbo found the One Ring, in a chance meeting with the creature Gollum (though at the time it was thought to be a lesser ring).
After escaping from the Misty Mountains pursued by Goblins and Wargs, the party was carried to safety by the Great Eagles. Gandalf then devised a plan to convince the chief of the Beornings, Beorn — who did not like uninvited guests or dwarves — to house and provision the company for the trip through Mirkwood.
Gandalf left the company before they entered Mirkwood, saying that he had pressing business to attend to. He turned up again, however, before the walls of Erebor disguised as an old man, revealing himself when it seemed the Men of Esgaroth and the Elves of Mirkwood would fight Thorin and the Dwarves over Smaug’s treasure. The Battle of the Five Armies ensued when hosts of Goblins and Wargs attacked all three parties. After the battle, Gandalf accompanied Bilbo back to the Shire, revealing at Rivendell what his pressing business had been: Gandalf had once again urged the Council to evict Sauron, since quite evidently Sauron did not require the Ring to continue to attract evil to Mirkwood. Then, in an event only briefly described (in The Silmarillion, The Hobbit, and The Lord of the Rings), the Council “put forth its power” and drove Sauron from Dol Guldur. Sauron, however, had anticipated this and withdrew as a feint, only to reappear in Mordor.