[5] Liu was later recalled to the capital Chang'an to serve as a copyeditor (校書郎, Xiaoshu Lang) at the Palace Library.
[3] Later in the year, he was made the minister of rites (禮部尚書, Libu Shangshu) and given the designation Tong Zhongshu Menxia Pingzhangshi (同中書門下平章事), making him a chancellor de facto.
At their behest,[3] in 874, Liu was sent out of the capital to serve as the military governor (Jiedushi) of Huainan Circuit (淮南, headquartered in modern Yangzhou, Jiangsu).
[3] While serving at Huainan, in 876, when Huainan came under the attack of the agrarian rebel Wang Xianzhi, Liu sought aid from the imperial government, and thus Emperor Xizong ordered Xue Neng (薛能) the military governor of Ganhua Circuit (感化, headquartered in modern Xuzhou, Jiangsu) to send several thousand soldiers to aid Liu.
Liu then resigned due to illness and was made Zuo Pushe (左僕射), one of the heads of the legislative bureau (尚書省, Shangshu Sheng).
[9] Liu was unable to follow Emperor Xizong in his flight, and he, as well as the current chancellors Doulu Zhuan and Cui Hang, hid at the house of the imperial guard general Zhang Zhifang,[3] who had publicly submitted to Huang but had secreted a number of Tang officials at his house.
[9] When the Qi troops intensified their searches for Tang officials, Liu fled with Doulu and Cui at night, but all three were captured.