The title of Dalai Lama is first bestowed on Sonam Gyatso (1543–1588), the third hierarch of the Gelugpa school of Tibetan Buddhism, by the Mongolian prince Altan Khan, a descendent of the great Genghis Khan, in the sixteenth century. Because his two predecessors received the title posthumously, Sonam is called the Third Dalai Lama. His incarnation and successor, the Fourth Dalai Lama, is Mongolian and a relative of the Khan. In 1642, the Fifth Dalai Lama, Ngawang Lobsang Gyatso (1617–1682), is installed as the undisputed ruler of Tibet. He becomes both a great scholar and an able administrator, earning the nickname “the Great Fifth.” The Fifth Dalai Lama creates the Tibetan theocratic state with the Dalai Lama at its head. For a dozen years, news of his death is hidden from the Chinese Qing emperor Kangxi by the regent Sangye Gyatso. Gyatso’s protégé, the Sixth Dalai Lama, accedes in 1695. In 1717, after years of unrest, the Chinese emperor finally installs the Seventh Dalai Lama and proclaims Tibet a Chinese protectorate. Although there are representatives of the Manchus in Tibet, the region is largely left to function independently and does so for the next 200 years.
Toward the end of the fifteenth century, Nepal is divided between the three sons of King Jayayaksha into three kingdoms: Kathmandu, Bhaktapur, and Patan. Over the next 250 years, the three kingdoms go through a process of consolidation and splintering, culminating in the reunification of the country under the Gorkha king Prithvi Narayana Shah in 1768–69. Kathmandu becomes the capital of the Gorkha kingdom shortly thereafter.