As of 878, by which time Emperor Yizong's young son
Emperor Xizong was emperor, Li Guochang's oldest son
Li Keyong was serving as the deputy commander of Shatuo soldiers at Datong Circuit, stationed at Wei Prefecture (蔚州, in modern
Zhangjiakou,
Hebei). At that time, most of the empire was overrun with agrarian rebellions; the Shatuo officer Li Jinzhong (李盡忠), technically Li Keyong's superior as the commander of the Shatuo soldiers at Datong, as well as his subordinates
Kang Junli, Xue Zhiqin (薛志勤), Cheng Huaixin (程懷信), and
Li Cunzhang, also considered rising in rebellion, particularly because the defender of Datong Circuit, Duan Wenchu (段文楚), was harsh to the soldiers, and was cutting back on their supplies. Li Jinzhong persuaded Li Keyong to agree to the rebellion, and then attacked and arrested Duan. Li Keyong subsequently arrived at Yun Prefecture and took control of the Datong headquarters, putting Duan and several of Duan's staff members to death cruelly. Li Guochang initially pledged continued faith to the imperial government, asking it to appoint a new defender of Datong and offering to attack Li Keyong himself if Li Keyong refused to comply. Emperor Xizong thus commissioned Lu Jianfang (盧簡方) as the new defender of Datong and asked Li Guochang to write a letter to persuade Li Keyong to accept Lu—but then decided to make Lu the military governor of Zhenwu and transfer Li Guochang to Datong instead (as military governor), believing that Li Keyong would not dare to resist his father. However, Li Guochang actually hoped for an arrangement where both he and Li Keyong would be each allowed to keep control of a circuit, and therefore, when he received the edict, he, in anger, tore the edict and killed the
eunuch monitor of the army. He then joined forces with Li Keyong in raiding the other circuits of the region. Emperor Xizong thereafter commissioned Cui Jikang (崔季康) as the military governor of Hedong to oversee the operations against Li Guochang and Li Keyong, while ordering
Li Keju the military governor of Lulong Circuit (盧龍, headquartered in modern
Beijing), Li Jun (李均) the military governor of Zhaoyi Circuit (昭義, headquartered in modern
Changzhi,
Shanxi), as well as the
Tuyuhun chiefs
Helian Duo and Bai Yicheng (白義誠), and the Sage (薩葛) chief Mi Haiwan (米海萬) to join in the attack as well. Li Keyong and Li Guochang initially gained successes in their raids on the neighboring circuits, and the Hedong soldiers were repeatedly intimidated into disturbances themselves, causing the successive expulsions or deaths of several Hedong military governors. However, after Li Zhuo (李涿) eventually took over the command of the entire operations, the tide began to turn against the Shatuo. In summer 880, Li Keyong's officer Gao Wenji (高文集), who was then defending Shuo Prefecture (朔州, in modern Shuozhou) for Li Keyong, surrendered to Li Zhuo along with Li Guochang's cousin Li Youjin (李友金) and several other chieftains. Li Keyong reacted by attacking Gao, to try to recapture Shuo Prefecture. Li Keju, however, attacked and defeated Li Keyong at Yao'er Heights (藥兒嶺, in modern
Chengde,
Hebei) before Li Keyong could do so, killing Li Jinzhong and Cheng. Li Keju then again defeated Li Keyong at Xiongwu Base (雄武軍, in modern Chengde). Meanwhile, Li Zhuo and Helian attacked Wei Prefecture, where Li Guochang had stationed himself at the time, defeating Li Guochang. Li Guochang, Li Keyong, and their family were forced to flee to the Dada (達靼) tribe, then in the
Yin Mountains region. Several months later, Helian, who was consequently made the defender of Datong, secretly tried to persuade the Dada to slaughter the Shatuo who fled to them. Li Keyong, hearing rumors of this, demonstrated his shooting skills at a feast with Dada nobles, and further proclaimed that he did not intend to stay with the Dada and wished to eventually assist the Tang imperial government in attacking the agrarian rebel
Huang Chao. After Li Keyong made that proclamation, the Dada became convinced that he would not stay and pose a threat to them, and therefore did not slaughter the Shatuo. Thereafter, Li Guochang and Li Keyong remained with the Dada for some time. == Exile and later resubmission to Tang ==