Trisong Detsen (742-797), emperor (tsenpo) of the Tibetan Empire, the ablest after Songtsen Gampo, named with him and Ralpacan one of the 'three dharma kings'. Powerful ministers ruled his early years; on coming of age he broke them and ruled alone, and Tibet reached its zenith: the eastern armies took Chang'an in 763, the west contended with the Arabs at the Pamirs, the south subdued Nanzhao and reached into India. At home he registered lands and households, fixed the military-civil divisions of the four ru and the sixty-one dongde, and promulgated law. Above all he raised Buddhism: he invited Shantarakshita, abbot of Nalanda, and the tantric master Padmasambhava into Tibet, built Samye (c. 779) — the first monastery with an ordained sangha in Tibet — institutionalized translation of the scriptures, and after the debate of the Council of Samye (792-794) fixed the Indian gradualist school as orthodox; Buddhism took root in the snow country from his reign. War and peace with Tang alternated — the treaty of Qingshui (783) drew a boundary that did not hold; after his death the Tang and Tibet made the great Changqing alliance of 821-22, 'uncle and nephew' swearing peace on stone — answering, across the decades, the marriage-alliance of Songtsen Gampo's day.