Under King Langdarma (Glang-dar-ma), there was a severe repression of Buddhism. This occurred, according to some sources, between 836 and 842. According to other sources, it was from 901 to 907. All monks were either killed or forced to disrobe, except for three: Mar Shakya (dMar Sha-kya), Yo Gejung (g.Yo dGe-‘byung), and Tsang Rabsel (gTsang Rab-gsal). The three escaped by passing through western Tibet and accepting temporary asylum in the Qarakhanid Turk territory of Kashgar, in East Turkistan (Xinjiang). They continued through the Tibetan cultural regions further to the east, at Dunhuang (Tunhuang) and Gansu (Kansu), which, being far from Lhasa, were spared the persecution.
According to some Mongol sources, they passed through Kyrgyz-ruled Mongolia and eventually hid on the eastern shores of Lake Baikal in Siberia. There, they gave initiations and teachings to Hortsa Mergen, grandson of the Mongol King Borti Chiney, the fifth generation ancestor of Chinggis Khan. According to other sources, they were given asylum in the Tangut Buddhist Kingdom of Mi-nyag (Mi-nyag), which spanned the region from northern Amdo to Inner Mongolia. Yet other sources identify more precisely the area in this region where they initially settled as having been part of the Tsongka (Tsong-kha) Kingdom at this time. The cave monastery Martsang (dMar-gtsang) in northern Amdo was later built at the cave where they supposedly stayed.
After several years, the three Tibetan monks moved to the southeastern Tibetan province of Kham (Khams, mDo-smad), where they stayed at Dentigshel retreat (Dan-tig-shel-gyi yang-dgon). A local herdsman wished to become a monk. They gave him the novice vows and novice name Gewa-rabsel (dGe-ba rab-gsal), but could not give him full monk’s vows since five monks are required to give full ordination.
At that time, the monk Lhalung Pelgyi-dorjey (Lha-lung dPal-gyi rdo-rje), the assassin of King Langdarma, had fled to nearby Longtang (Klong-thang). He was asked to help with ordinations, but explained that he could no longer qualify for this role. He promised, however, to help locate other monks. He found two Chinese monks, Ki-bang and Gyi-ban, and sent them to complete the count. In this way, with Tsang Rabsel as abbot, the former herdsman received the full monk’s vows and the full ordination name Gongpa-rabsel (dGongs-pa rab-gsal) in the presence of these five. In later times, people added the title Lachen (Bla-chen, Great Superior One), before his name.
Some youths from the Central Tibetan provinces of U (dBus) and Tsang (gTsang) heard of the monks in Kham. Lumey Tsultrim-sherab (Klu-mes Tshul-khrims shes-rab) led a party of ten seeking full ordination. This was either 53 or 70 years after Langdarma’s persecution. They requested Tsang Rabsel to be the abbot, but he declined due to old age. They then asked Gongpa-rabsel, but he explained that he had only been a full monk for five years and was not yet qualified. Ten years minimum was the requirement according to the texts. Nevertheless, Tsang Rabsel gave special permission for him to serve as abbot and the group of ten took the full monk’s vows.
Lumey stayed on for one year studying the vinaya rules of monastic discipline, while the other nine returned to Central Tibet. Before Lumey departed, Gongpa-rabsel had him dye his Bon hat yellow. He told him to wear it as a remembrance of his studies and practice. Lumey returned to Central Tibet and founded several temples there. The later propagation of the Buddhist teachings, and particularly of the monk’s vows, traces from him.
Several centuries later, monastic discipline had once more declined in Tibet. Tsongkhapa (rJe Tsong-kha-pa Blo-bzang grags-pa) (1357-1419) started a reform that developed into the New Kadam (bKa’-gdams gsar-pa) or Gelug (dGe-lugs) Tradition. He told his monk disciples to wear yellow hats. He explained that this would be an auspicious sign for them to be able to bring back pure ethical discipline to the monasteries of Tibet, just as Lumey had done in earlier times. In this way, the Gelug tradition also became known as the Yellow Hat Tradition.
The red hat worn in the other, earlier Tibetan Buddhist traditions follows the custom of the red hat worn by pandits (learned masters) at the Indian Buddhist Monastery of Nalanda.