While the Tibetan Plateau has been inhabited since pre-historic times, most of Tibet's history went unrecorded until the creation of Tibetan script in the 7th century. Tibetan texts refer to the kingdom of Zhangzhung (c. 500 BCE – 625 CE) as the precursor of later Tibetan kingdoms and the originators of the Bon religion. While mythical accounts of early rulers of the Yarlung dynasty exist, historical accounts begin with the introduction of Tibetan script from the unified Tibetan Empire in the 7th century. Following the dissolution of Tibetan Empire and a period of fragmentation in the 9th–10th centuries, a Buddhist revival in the 10th–12th centuries saw the development of three of the four major schools of Tibetan Buddhism.
After a period of control by the Mongol Empire and the also Mongol led Yuan dynasty, Tibet effectively became independent in the 14th century and was ruled by a succession of noble houses for the next 300 years. In the 16th century, the Dalai Lama title was created by Altan Khan, and as requested by the family of Altan Khan, seal of authority was granted to the Dalai Lama by the Wanli Emperor. In the 17th century, the senior lama of the Gelug school, the Dalai Lama, became the head of state with the aid of the Khoshut Khanate. Seal of authority and golden sheets were granted by the Shunzhi Emperor to both the Dalai Lama and the founder Güshi Khan of Khoshut Khanate in 1653. In 1717, the Dzungar Khanate invaded Lhasa, killed Lha-bzang Khan of the Khoshut Khanate, which effectively destroyed the Khoshut Khanate. The Qing dynasty then sent military troops in the same year to fight the Dzungars, but failed.