Imperial Guards (Tang dynasty)
The Imperial Guards of the Tang dynasty, also known as the Forbidden Troops (), were initially honor guards of the emperor and garrisons of the imperial capitals during the Tang's formation in the early 7th century. After the An Shi Rebellion, which lasted from AD 755 to 763, the Imperial Guards became the only military force that remained under direct control of the Tang court. The Pioneers
The dynasty's founder was an aristocrat based in present-day Taiyuan, and was an experienced soldier from his tenure as border commander. He launched his bid for power in AD 617 with only 30,000 troops, and by the time he defeated his rivals, he commanded more than 200,000 troops. About 30,000 volunteered to remain in service after general demobilisation; they became the pioneers of the Tang's hereditary Imperial Guards, and were assigned the fertile lands in the region of Bai irrigation canal, north of the Wei River, which had been abandoned during the turmoils of the Sui-Tang transition wars. This body became known as the Pioneer Forbidden Guards (元从禁军). The first body of the Imperial Guards were designated as bodyguards of the emperor, and would garrison the capitals and palaces. The mainstay of the empire's defence would be the fubing system, which assigned lands to farmers in return for periods of military service. Introduction of new Guard units

In the beginning of the reign of Emperor Taizong, the monarch stationed a hundred soldiers skilled in archery at the northern gate of the palace. They became known as the Hundred Riders (百骑), and accompanied the emperor during his hunting excursions. In addition, seven companies of soldiers selected after trials of strength and skills were installed under the Northern Bureau (北衙) as additional bodyguards. Gradually, other new units were added and stationed around the palace, their members chosen from upper class of societies who met the selection criteria of physical appearance, skills and strengths. Yü Lin (Feathered Forest) and Long Wu (Dragon Martial) Guards
In AD 662, Tang's third emperor transferred some outstanding horsemen, archers and footmen of the fubing army into the new Yü Lin (羽林, literally Feathered Forest) unit, and assigned them the duties of standing guard during Court sessions as well as imperial processions. The Hundred Riders unit was expanded by Empress Wu to Thousand Riders (千骑), then further increased by Emperor Zhongzong to Ten Thousand Riders (万骑). This unit was instrumental in the ousting of Empress Wei's faction by the Imperial Prince Li LongJi in AD 710, and subsequently renamed as Long Wu (龙武, literally Dragon Martial). Only descendants of pioneers of the Tang Empire were selected into the Long Wu Guards. In time, the appeal of serving in the Imperial Guard units waned, and many scions of influential clans resorted to hiring proxies to serve on their behalf. Thus, the quality of the "aristocratic" Long Wu guards levelled with that of the "commoner" Yü Lin guards. Shen Wu (Divine Martial) Guards
By the time An Lushan revolted in AD 755, enrollment in the Imperial Guard units had declined to such an extent that there were only a thousand guardsmen escorting Emperor Xuanzong during his flight from the capital. Emperor Xuanzong officially abdicated in favour of the Crown Prince Li Heng, who had to raise his own army in AD 757, which became known as the Shen Wu (神武, literally Divine Martial) Guards. Entry requirements had to be lowered when they could not recruit enough men from families of Court officials. Shen Ce (Divine Stratagem) Army

During the An Shi rebellion, the loyal jiedushi Geshu Han brought his garrison from the northwestern border with Tibet to the central plains to rally to the emperor. Due to politicking, control of this army came under the eunuch Yu Chao'En, and was subsequently known as the Shen Ce Army (神策军), literally Divine Stratagem Guards. This unit was instrumental in assisting Emperor Daizong recover the Imperial capital Chang'an from Tibetan invaders in AD 763, and thus gained prominence and became the mainstay of the central authorities' military force. The soldiers enjoyed better remuneration than those from other units. This led to other imperial military units to seek to come under its banner, expanding its numbers greatly. As a result, other Imperial Guard units declined. Control of the Shen Ce Army fell into the hands of the palace eunuchs who used it to control the Tang emperors. Later on, the Shence Army deteriorated into little more than local bullies in the vicinity of the capital. Quality declined sharply as recruitment fell in numbers and they were unable to withstand the rebel forces of Huang Chao in AD 880. In AD 903, after Zhu Wen deposed the last Tang Emperor and massacred the eunuchs in Chang'an, the last of Tang Imperial Guard units came to an end. References 

 New History of Tang, Volume 56, Chapter 40 - Tang's Military 《新唐书·卷五十六·志第四十·兵》 

Military history of the Tang dynasty
Royal guards
Military units and formations of the Tang dynasty
Military units and formations established in the 7th century
Chinese ceremonial units