Sangharama (Buddhist deity)
In East Asian Mahayana Buddhism, the Sangharama are a class of deities who are guardians of Buddhist temples and monasteries. Equivalent to the Taoist "realm master deity" (境主), the Sangharama are a lower class of Dharmapala. The Sangharama are dedicated to protecting the monastery area and all who practice within them. Sangharama in the time of the Buddha 

Sangharama originally referred to the eighteen holy protectors of the Dharma in the Seven Buddhas and Eight Bodhisattvas Great Dharani Mantra Sutra. Later on, the three meritorious ministers of the Jetavana,  Pasenadi of Kosala (Sanskrit name: Prasenajit, Pali name: Pasenadi), Prince Gita, and Anathapindika (Anathapindik, also known as Sudatta, meaning "Good Grant") donated a tree to Gautama Buddha because of the donation of the Jetavana premises. Anathapindik (also known as Sudatta, meaning "good grant") was included in the Gautama Sages because of the donation of "Jetavana" to Siddhartha, increasing the number of Gautama Sages to twenty-one. Chinese Buddhism 
In the Tang Song of China, Zen Bodhimaṇḍa already had a custom for venerating the Sangharama deity. The temple and monastery is protected by eighteen gods, and those who live in it encourage themselves and not be lazy for fear of incurring present retribution. It is said that all gods have countless dependents, that is, they are assigned to guard. To this day, monasteries incorporate this praise to the Sangharama deity during the daily evening recitations: 

"Lord Sangharama, the temple's mighty spirit, is dedicated to the Buddha's edict to convey sincerity; to protect the city of the Dharma King, acting as a barricade and sentry, he brings eternal peace to the temple. Homage to the Protector of the Dharma Treasury Bodhisattva Mahasattva." In gratitude for the virtue of the Bodhisattva's protection of the Dharma, some publishers of sutras also print the image of either Sangharama or Skanda on the end pages in the hope of receiving the protection of the dharmapala. Most Chinese Buddhist Bodhimaṇḍas today portray the Sangharama Bodhisattva in the form of Guan Yu, rather than the original twenty-one Sangharama beings. Guan Yu as Sangharama 
The Buddhist scriptures do not record Guan Yu as a Sangharama deity, and there was no such custom before the Sui dynasty. The origin of this is said to be related to the Tiantai Sect founder, Zhiyi Masters. Legend has it that Zhiyi was searching for a site to build a temple on Jade Spring Hill in Jingzhou when Guan Yu appeared while he was meditating in the mountain at night and offered to help him build the temple. After the temple was completed, Guan Yu became a disciple of the Buddha by taking refuge and vowed to be a protector of Buddhism. From then on, temples began to worship Guan Yu as their protector. However, replacing the original twenty-one bodhisattvas with Guan Yu alone does not seem to be the original intention of Zhiyi. The fourth volume of the "Biography of the Wise Master" records this matter: "On the evening when the clouds opened up and the moon was clear, I saw two men, with all the ministers, as majestic as kings, the elder one with beautiful beard and rich, the younger one with crowned hat and beautiful hair, coming forward to pay homage! The teacher asked where he came from? He said he was Guan Yu, the former general of Shu, and pointed to the young man and said: My son Guan Ping also. The Han dynasty at the end of the chaos, Nine Provinces split, Cao Cao unkind, Sun Quan self-preservation, I righteous subject Shu Han, hope to restore the emperor's family, the time is contrary, have the will to fail, die with residual martyrdom. "The teacher then held the furnace and gave the five precepts." In these accounts, there is no mention that the Master of the Wise Men wanted to replace the original twenty-one holy saints with Guan Yu alone. However, after the precedent of worshipping Guan Yu was set by the Tiantai Buddhist monasteries, all the monasteries followed suit, and gradually Guan Yu became the two major Dharmapala in Chinese Buddhist monasteries, along with Skanda (you can see Guan Yu standing to the right of the statue of Wijunda in the painted or sculpted Quan Tang Buddha Statue). In temples where Buddhism and Taoism are fused and where there is a Three Jewels Hall or a Guanyin Hall, it is common to have the statues of Skanda and Guan Yu standing left and right in front of the hall. Later on, Guan Yu's festival day - the 13th of May or the 24th of June on the Chinese calendar - is regarded as the Christmas of Garan Bodhisattva. Some Buddhist temples also hold special Buddhist services to commemorate this occasion. What's more, a few Buddhist temples have also built "Guan-Di Hall" (or "Hall of Demons") for Guan Yu. Unlike other religions that worship Guan Yu, the statue of Guan Yu is always in a standing position (or in a seated position if worshiped in a separate temple), and it is customary for the statue to have an additional ribbon to wrap around the deity without wind; however, the ribbon is not inevitable, for example, the statue of Guan Gong in Chung Tai Chan Monastery does not have a ribbon. Other Sangharama deities 
The use of Guan Yu as a deity in Chinese Buddhist temples is a phenomenon of Buddhist fusion with Chinese culture, with Han deities guarding Buddhist temples, showing the transfer of folk culture to Buddhism, or Buddhism's desire to attract (or draw in) folk beliefs. Buddhist temples also have other gods:

 Daigen Shuri Bosatsu (大権修利菩薩): According to legend, he is the seventh son of Ashoka., He was once escorted to China by Śarīra and was later revered as a Bodhisattva. This deity is worshipped in the Caodong school monasteries as , a Sangharama deity. The king of the Kama-vipassana family is also known as Kapila. He is the guardian deity of Karan, so he is called the King of Karan. He is one of the four night gods who protects the east, and is also known as the Yellow Shirt God. The god of wealth and fortune, if you pray for good fortune, you will be able to fulfill your wishes. The name of the god is Zhang Bo, and the word Bo Qi. Dong Yue Da Di
 Ping Shui Da Wang: The Great Yu the Great. Hwagwang Daedei: The god of Hwagwang Daedei is worshiped at the Puji Temple in Mount Putuo and at the Huangbaku sect's Daifuji Temple in Kyoto, Japan. The God of Five Blessings: The God of Five Blessings is worshipped at Tantou Town in Changle City, for example. See also 
 Chinjugami
 Sangharama
 Dharmapala

External Links 

 伽藍聖眾之由來及其訛傳

References 

Dharmapalas
Pages with unreviewed translations
 
Zen art and culture
Buddhism in China
Buddhist art
Tutelary deities