The Samye Monastery or Samye Gompa is the first Buddhist monastery built in Tibet. It was most probably first constructed between 775 and 779 CE under the patronage of King Trisong Detsen of Tibet who sought to revitalize Buddhism, which had declined since its introduction by King Songtsen Gampo in the 7th century. The monastery is in Dranang, Shannan Prefecture. It was supposedly modeled on the design of Odantapuri monastery in what is now Bihar, India.
The 18th century Puning Temple of Chengde, Hebei, China was modeled after the Samye Gompa.
According to tradition, the Indian monk Shantarakshita made the first attempt to construct the monastery while promoting his sutra-centric version of Buddhism. Finding the Samye site auspicious, he set about to build a structure there. However, the building would always collapse after reaching a certain stage. Terrified, the construction workers believed that there was a demon or obstructive thoughtform in a nearby river making trouble.
When Shantarakshita's contemporary Padmasambhava arrived from northern India, he was able to subdue the energetic problems obstructing the building of Samye. According to the Fifth Dalai Lama, Padmasambhava performed the Vajrakilaya dance and enacted the rite of 'thread cross' or namkha to assist King Trisong Deutsen and Shantarakshita clear away obscurations and hindrances in the building of Samye:
"The great religious master Padmasambhava performed this dance in order to prepare the ground for the Samye Monastery and to pacify the malice of the lha [local mountain god spirits] and srin malevolent spirits in order to create the most perfect conditions." He went on to say that after Padmasambhava consecrated the ground he erected a thread-cross — a web colored thread woven around two sticks — to catch evil. Then the purifying energy of his dance forced the malevolent spirits into a skull mounted on top of a pyramid of dough. His tantric dance cleared away all the obstacles, enabling the monastery to be built in 767. The dance was memorialized by the construction of Vajrakilaya stupas — monuments honoring the ritual kilya (purba) daggers — at the cardinal points of the monastery, where they would prevent demonic forces from entering the sacred grounds.
The abovementioned quotation makes reference to the relationship of the Vajrakilaya/Phurba to the Stupa and mentions torma and namkha. Moreover, the building of Samye marked the foundation of the original school of Tibetan Buddhism, the Nyingma. This helps explain how Padmasambhava's tantric-centric version of Buddhism gained ascendence over the sutra-based teaching of Shantarakshita.
Pearlman succinctly charts the origin of the institution of the Nechung Oracle:
When Padmasambhava consecrated Samye Monastery with the Vajrakilaya dance, he tamed the local spirit protector, Pehar Gyalpo, and bound him by oath to become the head of the entire hierarchy of Buddhist protective spirits. Pehar, later known as Dorje Drakden, became the principal protector of the Dalai Lamas, manifesting through the Nechung Oracle.
The original buildings have long disappeared. They have been badly damaged several times — by civil war in the 11th century, fires in the mid 17th century and in 1826, an earthquake in 1816, and in the 20th century, particularly during the Cultural Revolution. As late as the late 1980s pigs and other farm animals were allowed to wander through the sacred buildings. Each time it has been rebuilt, and today, largely due to the efforts of the 10th Panchen Lama from 1986 onward, it is again an active monastery and important pilgrimage and tourist destination.