Tales from the Wilderlands
"The Grey Pilgrim"
In origin a Maia of Manwë and Varda, Gandalf came to the northwest of Middle-earth after a thousand years of the Third Age had passed, with four others of his order. At the Grey Havens, Círdan entrusted him with the Red Ring, Narya, to aid him in contesting the will of Sauron.
Gandalf wandered widely in Middle-earth, and learned much of its races and peoples. Unlike his fellow Wizards Saruman and Radagast, he never settled in a single place. He was instrumental in the victory of the War of the Ring, but during that conflict he battled with a Balrog, and though he was ultimately victorious, his spirit left his body, but was sent back to Middle-earth to complete his task.
Gandalf finally left Middle-earth in 3021 (Third Age), when he departed over the sea with the Ring-bearers.