The Shence Army was a Tang dynasty (618 - 907) army unit established in 754 CE by Emperor Xuanzong of Tang, and based in Chang'an, forming the core of the imperial guards responsible for protecting the emperor. The command of the Shence Army was originally given to Longyou Military Governor (隴右節度使) Geshu Han. Headquartered to the west of Lintao County, Gansu Province at Mohuan Chuan (磨環川) (south east of modern-day Lintan County), the Shence Army defended the western border close to the capital against the Tibetan Empire. The Shence Army played a pivotal role as a tool of the eunuchs in establishing and keeping control over the Tang court through military clout.
During the An Shi Rebellion (755 - 763), General Wei Boyu (卫伯玉/衛伯玉) and 1,000 of his Shence troops were dispatched to assist the embattled central authorities. Thereafter Wei Boyu defended the area around Sanmenxia where troops from Tufan had already occupied Lintao County. At the same time Yu Chao'en was appointed Army Censor (监军/監軍) by the imperial court and later commanded the Shence Army. In 763 CE Tubo attacked Chang'an whereupon Emperor Daizong of Tang fled to Sanmenxia. Yu Chao’en's army and the Sanmenxia armies combined and were collectively referred to as the Shence Army. When Daizong later returned to the capital, the Shence Army became one of the imperial guard units and gradually increased in strength.
Because pay and conditions for the soldiers of the Shence Army were relatively good, a gradual succession of other imperial guard units gradually joined its ranks. By the time Emperor Dezong of Tang ascended the throne the force had grown to contain 150,000 troops and was the main military power in both Chang'an and the surrounding Guanzhong Plain.After Zhu Ci's rebellion in 784 CE, command of the Shence Army was handed over to the court eunuchs for whom it became the emperor's primary military tool. When Xuānzong ascended the throne Ma Yuanzhi (马元贽/馬元贄) was given command of the Shence ArmyUnder succeeding Emperor Shunzong of Tang, court official Wang Shuwen unsuccessfully tried to wrest control of the army from the eunuchs, thereafter in the final years of the Tang dynasty the Shence Army became riddled with corruption and its power declined.Under Emperor Xizong of Tang (r.873 - 888) the Shence Army was totally routed during the Huang Chao Rebellion[1] Whilst the emperor fled to the Xichuan Circuit (西川路) headquartered in modern-day Chengdu, Sichuan Province, eunuch Tian Lingzi raised a new Shence Army. The unit was finally disbanded in 903 CE when Zhu Wen, founder of the Later Liang murdered all the palace eunuchs in Chang’an.