Emperor Daizong was the eldest son of Emperor Suzong – the first Emperor of the Tang dynasty to succeed as the eldest child, and during the Anshi Rebellion (which Emperor Suzong's entire reign was dedicated to fighting), he served as a general of Tang and Huige joint operations that recaptured the capital Chang'an and the eastern capital Luoyang from the rebel state of Yan, and the Anshi Rebellion was finally put down early in his own reign, in 763. However, thereafter, the Tang state was plagued by warlords such as Tian Chengsi, Li Baochen, and Liang Chongyi who essentially governed their realms as independent states while only pledging nominal loyalty to the emperor. This would prove disastrous for future generations as subsequent Tang emperors were unable to remove or control these warlords and the central government's power was thus slowly eroded and diminished. The power of the warlords would not prevent the Tang western territories from being overrun by Tibetan invasions and eventually lost to the Tibetan Empire, which even managed to capture Chang'an in 763 for a short period before being expelled.