Background
It is not known when Liu Wu was born. His grandfather Liu Zhengchen () had served as the Tang military governor ('' jiedushi'') of Pinglu Circuit (平盧, then headquartered in modern Chaoyang, Liaoning) during the Anshi Rebellion and combatted the army of the rebel Yan, but was unable to capture the Yan northern capital Fanyang before being poisoned by his own subordinate Wang Xuanzhi ().'' New Book of Tang'', vol. 214. During the time that Liu Wu's uncle Liu Quanliang () served as the military governor of Xuanwu Circuit (宣武, headquartered in modern Kaifeng, Henan), as he valued Liu Wu for Liu Wu's bravery and decisiveness, he made Liu Wu an officer under him, but Liu Wu subsequently committed a crime and fled to Zhaoyi Circuit (昭義, headquartered in modern Changzhi,Service under Li Shigu and Li Shidao
Liu Wu subsequently fled to Pinglu Circuit (by this point headquartered in modern Tai'an, Shandong) to serve under the military governor Li Shigu,'' Old Book of Tang'', vol. 161. who ruled the circuit in ''de facto'' independence from the imperial government. Liu was not initially well known in the Pinglu army. On one occasion, when the officers were playing polo, his horse charged Li Shigu's horse, causing Li Shigu's horse to fall. Li Shigu, in anger, was set to execute him. Liu responded with proud words without fear. Li Shigu was amazed and pardoned him, and found a wife for him. He thereafter was promoted several times, until he became army commander (兵馬使, ''Bingmashi''). In 818, after Emperor Xianzong declared a general campaign against Li Shigu's brother and successor Li Shidao,''Zizhi Tongjian'', vol. 240. Li Shidao had Liu command troops to defend against imperial armies' attack, in position at Cao Prefecture (曹州, in modern Heze, Shandong). It was said that Liu was lenient and simplified the military laws, and as a result the soldiers were happy to be under his command—such that he was referred to as "Father Liu."''Zizhi Tongjian'', vol. 241. After Tian Hongzheng the military governor of Weibo Circuit (魏博, headquartered in modern Handan, Hebei) crossed the Yellow River and pressured Pinglu's capital Yun Prefecture () directly in winter 818, Liu stationed his army at Yanggu (陽穀, in modern Liaocheng, Shandong) to defend against Tian. Tian's army repeatedly prevailed over Liu's, and there were accusations by some of Li Shidao's associates that Liu was plotting against him. Li Shidao thus summoned Liu back to Yun Prefecture under the guise of a strategic meeting but planned to execute him. Yet other associates of Li Shidao's counseled that if he put Liu to death without proof of treachery, no one would remain faithful to him. After keeping Liu at Yun Prefecture for 10 days, Li Shidao ordered him to return to Yanggu and gave him gifts to try to secure his loyalty. However, because Liu Wu's son Liu Congjian served in Li Shidao's guard corps, he found out about what Li Shidao had originally intended and reported it to Liu Wu, so Liu Wu secretly took precautions. In spring 819, Li Shidao became resolved to kill Liu Wu. He sent two messengers to Liu's deputy Zhang Xian (), ordering Zhang to execute Liu and take over the army. When the messengers informed Zhang, Zhang, who was friendly with Liu, secretly informed Liu, who immediately put the two messengers to death. Liu then called a meeting with all of his officers, declaring that he was set to turn against Li Shidao and follow imperial orders. When some officers hesitated, he executed them, as well as a number of others that soldiers had resented. The other officers were intimidated into submission. At night, they launched a surprise attack on Yun Prefecture, and the Yun Prefecture defenders, believing that Liu was returning on Li Shidao's orders, allowed them in. Liu Wu controlled the city and arrested Li Shidao and his two sons, putting them to death. He then sent messengers to surrender to Tian, but continued to maintain control over Yun Prefecture.As ''jiedushi''
Because Emperor Xianzong had previously issued an edict stating that whoever killed Li Shidao would be conferred all of Li Shidao's titles, Liu Wu believed that he would be given Pinglu's 12 prefectures, and therefore started making personnel changes for the entire circuit. Meanwhile, though, Emperor Xianzong was secretly planning to divide Pinglu into three circuits and transferring Liu elsewhere, but was concerned that Liu might resist. He ordered Tian to evaluate the situation, and Tian thus sent messengers to Liu, ostensibly to befriend Liu, but secretly to observe Liu. As Liu was strong and liked arm wrestling, within three days, he was encouraging soldiers to arm wrestle and watching them doing so in excitement. When the Weibo messengers reported this back to Tian, Tian opined to Emperor Xianzong that Liu, if transferred elsewhere, would not resist. Soon thereafter, Emperor Xianzong issued an edict commissioning Liu as the military governor of Yicheng Circuit (義成, headquartered in modern Anyang, Henan). Liu was surprised and decided to submit—and, as soon as he left the city, Tian, approaching with Weibo and other circuits' troops, met him and gave him the seals of the Yicheng governorship. Liu took with him several colleagues who had unsuccessfully counseled Li Shidao not to resist imperial authority—Li Gongdu (), Li Cun (), Guo Hu (), and Jia Zhiyan ()—with him, and invited them to serve under him at Yicheng. Liu's submission to imperial authority was considered the apex of Emperor Xianzong's campaign to end warlordism in his realm, referred to historians as the Yuanhe Restoration (元和中興, ''Yuanhe'' being Emperor Xianzong's era name).'' Bo Yang Edition of the Zizhi Tongjian'', vol. 58 19 Emperor Xianzong created Liu the Prince of Pengcheng and awarded him a mansion and an estate. In spring 820, Liu went to Chang'an to pay homage to Emperor Xianzong. Late in 820, by which time Emperor Xianzong had died and been succeeded by his son Emperor Muzong, Wang Chengzong the military governor of Chengde Circuit (成德, headquartered in modern Shijiazhuang, Hebei) died. His brother Wang Chengyuan, fearing the fate of Li Shidao, offered to surrender the circuit's control to the imperial government. Emperor Muzong, as a result, made a number of transfers of military governors around Chengde—transferring Tian to Chengde, Wang Chengyuan to Yicheng, Liu to Zhaoyi Circuit, and Li Su the military governor of Wuning Circuit (武寧, headquartered in modern Xuzhou, Jiangsu), and also making Tian's son Tian Bu the military governor of Heyang Circuit (河陽, headquartered in modern Jiaozuo, Henan). In 821, after soldiers at Lulong Circuit (盧龍, headquartered in modernNotes and references