Gandalf was one of the Istari sent to Middle-earth in around T.A. 1000 in order to assist the free peoples of Middle-earth against Sauron.1
Gandalf was a Maia known by the name Olórin and dwelt in the gardens of Irmo in Valinor. Olórin was associated to Manwë and Varda but was a pupil of the Vala Nienna. He was said to be the wisest of the Maiar.2
Olórin was one of five emissaries, the Istari, selected by the Valar to aid the free peoples of Middle-earth against Sauron in the Third Age. He journeyed from Valinor to Mithlond around T.A. 1000 as the last of the five Istari.3
In Mithlond Olorín met with Círdan the Shipwright who, sensing his power and future struggles, gave Olorín the elven ring Narya.1
During their mission the Istari were restricted to the bodies of old men so that they would not seek to dominate other races. Olórin is described to have the appearance of a bent old man with long grey hair, dressed in a grey robe. To the peoples of Middle-Earth he was known under many names. Mithrandir to the Elves, Tharkûn to the Dwarves but most commonly Gandalf, a name he was given by the Men of Arnor.3
For many years after his arrival Gandalf wandered the lands of Middle-Earth. He did not take a permanent residence but restricted his activities to the Westlands. During this time an unknown evil entity, called the Necromancer, was discovered in Dol Guldur. In T.A. 2063 Gandalf journeyed there in an attempt to find out what this entity was but failed as it fled before him. The evil diminished and this marked the beginning of the Watchful Peace.1
When the Necromancer returned to Dol Guldur in T.A. 2460 the Wise formed the White Council. Galadriel wished Gandalf to become its leader but he declined. Gandalf entered Dol Guldur in secrecy in T.A. 2850 discovering that the Necromancer was in fact Sauron.1
In the dungeons Gandalf found Thráin, a Dwarf of the royal line of Dúrin, who gave him the key and map to the Lonely Mountain shortly before he died.4
When returning to the Council Gandalf advocated an attack on Sauron but Saruman and the majority of the Council instead wanted to watch and wait.5
In T.A. 2941 Thorin II Oakenshield and Gandalf met by a strange coincidence in Bree, for they both sought to talk to eachother.1, 6
They agreed on a plan to reclaim Erebor and destroy the dragon Smaug. Gandalf had a feeling a Hobbit should be involved in the mission, or it would fail, and selected Bilbo Baggins to become Thorin's burglar.
Gandalf travelled with Thorin and Company to the border of Mirkwood. During the journey he found the sword Glamdring in a troll-hoard.7
Gandalf left the Company before reaching Erebor and participated in an attack on Dol Guldur forcing Sauron from Mirkwood.1
However, Sauron openly proclaimed himself in Mordor only ten years after this.
After the Quest for Erebor Gandalf frequently visited the Shire where he noted the youthfulness of Bilbo. This grew his suspicion towards Bilbo's magical ring and convinced him to leave it to his nephew, Frodo. Gandalf befriended Aragorn in 2956 and recieved his help in capturing Gollum. With Gollum's tale, and the records in Minas Tirith, he pieced together the missing history of the One Ring in T.A. 3017.
When Gandalf learned of Gollum's visit to Barad-dûr he returned to the Shire and advised Frodo to leave as soon as possible. After hearing disturbing news from Radagast Gandalf travelled to Isengard to seek advise from Saruman. Saruman openly revealed his desire for the One Ring and imprisoned Gandalf when he rejected his ideas.
Gandalf was rescued by the eagle Gwaihir who flew him to Rohan. There he received the horse Shadowfax from King Theoden of Rohan. He sped to the Shire finding Frodo had already left and learning of the Black Riders. In Bree he found out the Hobbits had left with Aragorn as their guide and rode for Weathertop. After being attacked at night by the Black Riders he rode directly to Rivendell.
In Rivendell Gandalf partcipated in the Council of Elrond and advised the Ring should be destroyed. He was selected as the leader of the Fellowship of the Ring and set out for Orodruin. After a failed attempt to pass through the Redhorn Pass he led the company to Moria. At the Bridge of Khazad-dûm they were caught up by a Balrog of Morgoth known only as Durin's Bane. Gandalf faced the demon and ultimately fell from the bridge with the Balrog. Gandalf finally pursued the beast up the Endless Stair to the peak of Celebdil where he cast it down the mountain side before passing out and his spirit left his body.
As the only one of the five Istari to stay true to his errand, Gandalf was sent back by Eru. He was also allowed to reveal more of his inner strength. Again he was rescued by Gwaihir who bore him to Lothlórien where Galadriel gave him a new staff. Learning Frodo and Sam had left the Fellowship he left for Fangorn Forest. There he met up with Aragorn, Legolas and Gimli and rode with them to Edoras.
In Edoras Gandalf freed Théoden from the deceit of Gríma Wormtongue and encouraged him to take refuge at Helm's Deep. After the Ent's attack on Isengard Gandalf confronted Saruman and offered forgiveness. Saruman rejected this offer and Gandalf broke his staff and cast him from the White Council.
Together with Pippin Gandalf rode for Minas Tirith which was besieged shortly after their arrival. In the middle of battle, at the destroyed gate of the city, Gandalf met and defied the Witch-King. The stand-off ended inconclusively, as the host of the Rohirrim arrived and broke the siege.
After the victory it was decided that Gandalf and Aragorn should lead a host to Morannon thus drawing Sauron's attention from Frodo and Sam. At the gate Gandalf was shown Frodo's Mithril coat by the Mouth of Sauron and was offered to surrender. Gandalf rejected. Only a short time after the Battle of Morannon the One Ring was unmade in the fires of Mount Doom and Sauron destroyed.
Positions & titlesBearer of Narya ~ T.A. 1000 -
1 - J.R.R. Tolkien, The Lord of the Rings, Appendix B, "The Third Age"
2 - J.R.R. Tolkien, Christopher Tolkien (ed.), The Silmarillion, "Valaquenta: Account of the Valar and Maiar According to the Lore of the Eldar"
3 - J.R.R. Tolkien, Christopher Tolkien (ed.), Unfinished Tales, "The Istari"
4 - J.R.R. Tolkien, The Lord of the Rings, Appendix A, Durin's Folk
5 - J.R.R. Tolkien, Christopher Tolkien (ed.), The Silmarillion, "Of the Rings of Power and the Third Age"
6 - J.R.R. Tolkien, Christopher Tolkien (ed.), Unfinished Tales, "The Quest of Erebor"
7 - J.R.R. Tolkien, The Hobbit, "Roast Mutton"