to Jiangdu from there. In 617, Li Yuan indeed rebelled, and soon captured Chang'an, declaring Emperor Yang's grandson Yang You the Prince of Dai emperor (as Emperor Gong) but seizing power as regent. Knowing that Li Jing was planning to report his plans to Emperor Yang, Li Yuan set to execute him. At the execution, Li Jing yelled, "You, duke, rose in order to eliminate tyrannical rule for the people. You are not concerned about what is important, but instead are executing a brave man on account of personal enmity!" Li Yuan was impressed by his words, and Li Yuan's son Li Shimin interceded on Li Jing's behalf. Li Yuan released Li Jing, whom Li Shimin soon retained Li Jing to serve on his staff. During Emperor Gaozu's reign In 618, after news arrived at Chang'an that Emperor Yang was killed in a coup at Jiangdu led by the general Yuwen Huaji, Li Yuan had Yang You yield the throne to him, establishing Tang dynasty as its Emperor Gaozu. Li Jing continued serving the new dynasty. In 619, Li Jing participated in a campaign against one of Tang's major enemies, Wang Shichong the Emperor of Zheng, and was promoted for his accomplishments. Later that year, Emperor Gaozu sent him to Kui Prefecture (夔州, modern eastern Chongqing) to plan a military operation against another major enemy, Xiao Xian the Emperor of Liang, who then ruled the modern Hubei, Hunan, and Guangxi region. When he first reached Jin Prefecture (金州, roughly modern Ankang, Shaanxi), he encountered bandits in the mountain, who had several times defeated Li Yuàn (李瑗, note different tone and character than Emperor Gaozu's name (淵, yuān)) the Prince of Lujiang (Emperor Gaozu's distant nephew). Li Jing joined forces with Li Yuàn to defeat those bandits. However, as he arrived at the borders with Liang, he was blocked by Liang forces and long could not reach there, having to stop at Xia Prefecture (峽州, roughly modern Yichang, Hubei). Emperor Gaozu, believing that Li Jing was intentionally not advancing, was sufficiently angry that he secretly ordered the commandant at Xia Prefecture, Xu Shao (許紹), to execute Li Jing. Xu, however, was appreciative of Li Jing's talent, and submitted a petition urging that Li Jing be spared, and Emperor Gaozu relented. Meanwhile, in spring 620, around the same time, Ran Zhaoze (冉肇則) the leader of the Kaishan Tribe (開山蠻), rebelled against Tang