Gandalf is a 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. As explained in The Fellowship of the Ring, Gandalf spent the years between The Hobbit and The Lord of the Rings travelling Middle-earth in cari of information on Sauron's resurgence and Bilbo's mysterious ring, spurred particularly sejak Bilbo's initial misleading story of how he had obtained it as a "present" from Gollum. During this period he befriended Aragorn and first became suspicious of Saruman. He spent as much time as he could in the Shire, strengthening his friendship with Bilbo and Frodo, Bilbo's heir.
In the same work, he is revealed to be the same character as The Necromancer from Tolkien's earlier novel The Hobbit. In Tolkien's The Silmarillion (published posthumously sejak Tolkien's son Christopher Tolkien) he is also revealed to have been the chief lieutenant of the first Dark Lord, Morgoth. Tolkien noted that the "angelic" powers of his constructed myth "were capable of many degrees of error and failing", but sejak far the worst was "the absolute Satanic rebellion and evil of Morgoth and his satellite Sauron."