During the Anshi Rebellion (which Emperor Suzong 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. 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. Emperor Daizong was himself also said to be overly devout in Buddhism.