The Origins of the Maia Olórin
In the Elder Days, before the shaping of the world and the kindling of the Lamps, there dwelt in the halls of Eru Ilúvatar the spirits who would become the Ainur. Among the Maiar of Manwë and Varda, none was more renowned for his wisdom than Olórin. He walked often in the gardens of Lórien, dwelling in the house of Nienna, from whom he learned pity and patience, virtues that would define his mission in the later Ages. When the shadow of Sauron grew long in Middle-earth following the fall of Númenor, the Valar convened in council to determine the fate of the Free Peoples. It was decreed that emissaries, the Istari, should be sent to challenge the Enemy. Olórin was chosen, though he went with reluctance, fearing the power of the Dark Lord. He arrived upon the shores of the Grey Havens in the eleventh century of the Third Age, appearing as an aged man, cloaked in grey, leaning upon a staff. There, Círdan the Shipwright, perceiving his true stature, entrusted to him Narya, the Ring of Fire, to kindle hearts in a world grown cold.
The Wanderings and the War of the Ring
For two millennia, he who was known as Gandalf the Grey wandered the wide lands of Middle-earth. He was a master of lore and a friend to all who resisted the encroaching dark. In Dol Guldur, he discovered the Necromancer to be none other than Sauron returned, and he urged the White Council to strike, yet his counsel was delayed by the pride of Saruman. His deeds were manifold: he guided the line of the Kings in the North, he befriended the Hobbits of the Shire, and he set in motion the quest of Thorin Oakenshield to reclaim the Lonely Mountain, an act that would inadvertently lead to the discovery of the One Ring by Bilbo Baggins. When the shadow deepened once more, Gandalf took upon himself the burden of the Fellowship, leading the Ring-bearer and his companions through the perilous mines of Moria. There, upon the Bridge of Khazad-dûm, he stood against the Balrog of Morgoth, a demon of the Elder Days. In the ensuing struggle, he cast down his foe, yet was himself pulled into the abyss, and there, in the depths and upon the peaks of Zirakzigil, he perished in the flesh.
The Return as the White and the Passing
Yet the mission of the Istari was not yet fulfilled, and the needs of Middle-earth were great. By the grace of the One, Olórin was sent back, clothed in new raiment, as Gandalf the White. He returned to the world of men at the hour of their greatest despair, breaking the spell of Saruman at Edoras, rallying the forces of Rohan for the defense of the West, and standing as the true pillar of strength during the Siege of Gondor. It was his hand that directed the defense of the White City against the hosts of Mordor, and his wisdom that urged the final, desperate march upon the Black Gate to distract the Eye of Sauron, thereby granting the Ring-bearer the path to reach Mount Doom. With the destruction of the Ring and the fall of the Barad-dûr, the Third Age drew to its close. Having seen the return of the King and the restoration of the West, Gandalf joined the Keepers of the Three Rings at the Grey Havens. In the final year of the Third Age, he boarded the White Ship, passing into the West, to the Undying Lands, where his task was finished and his spirit finally found rest.