Li Keyong () (October 24, 856 – February 24, 908) was a military general and politician of Shatuo Turk ethnicity, and from January 896 the Prince of Jin (), which would become an independent state after the fall of the Tang dynasty in 907. Li served as a Jiedushi provincial military governor during the late Tang period and was an instrumental figure in the development of a Shatuo base of power in what is today's Shanxi Province of China. His son Li Cunxu (Emperor Zhuangzong), a child of his concubine Lady Cao, would succeed him as Prince of Jin and eventually become the founding emperor of the Later Tang dynasty in 923.

Background Li Keyong—although he would have initially carried the surname of Zhuye—was born in 856, during the reign of Emperor Xuānzong. His father was the Shatuo chieftain Zhuye Chixin, whose people were then living in the Shenwu River (神武川, flowing through modern Shuozhou, Shanxi) region. His mother was Lady Qin, and it is not clear whether she was Zhuye Chixin's wife or concubine. He was Zhuye Chixin's third son.

In 869, during the reign of Emperor Xuānzong's son Emperor Yizong, as the Tang imperial general Kang Chengxun was commissioned to suppress the rebellion of Pang Xun at Xu Prefecture (徐州, in modern Xuzhou, Jiangsu), he invited Zhuye to bring his Shatuo soldiers and serve under him. Zhuye agreed, and then-14-year-old Li Keyong fought in the campaign so fiercely that he became known as the "Son of the Flying Tiger" (飛虎子). After the campaign, to recognize Zhuye Chixin's contributions during the campaign, Emperor Yizong bestowed on him the imperial surname of Li, and gave him a new name of Guochang.Zizhi Tongjian, vol. 251. Li Keyong presumably took the imperial surname of Li at that time as well. Li Guochang was subsequently made the military governor (Jiedushi) of Zhenwu Circuit (振武, headquartered in modern Hohhot, Inner Mongolia). Li Keyong went to Zhenwu as well to serve under his father.

During Emperor Xizong's reign

Initial rebellion against Tang Dynasty As of 878, Li Keyong was serving as the deputy commander of the Shatuo troops at Datong Circuit (大同, headquartered in modern Datong, Shanxi) and stationed at Yu Prefecture (蔚州, in modern Zhangjiakou, Hebei). At that time, the commander of the Shatuo troops at Datong was Li Jinzhong (李盡忠), who, along with his officers Kang Junli, Xue Zhicheng (薛志誠), Cheng Huaixin (程懷信), and Li Cunzhang considered the Tang realm to be in such disarray due to agrarian rebellions (the chief of which was Huang Chao's rebellion), and Li Jinzhong wrote Li Keyong, encouraging him to overthrow the defender of Datong, Duan Wenchu (段文楚), who had drawn the ire of the soldiers by deducting their clothing and food stipends and being harsh in his enforcement of laws. Li Jinzhong then started a mutiny at Datong's capital Yun Prefecture (雲州), arresting Duan and his assistant Liu Hanzhang (柳漢璋). Li Keyong soon arrived, executed Duan and four of his subordinates, and claimed the title of defender of Datong. He sought imperial commission, but then-ruling Emperor Xizong refused.Zizhi Tongjian, vol. 253.

Upon hearing of Li Keyong's mutiny, Li Guochang, then still the military governor of Zhenwu, initially submitted a petition to Emperor Xizong proclaiming his loyalty and asking Emperor Xizong to commission another defender of Datong—going as far as stating that if Li Keyong refused, he would be willing to attack Li Keyong himself. Instead, the imperial government requested that Li Guochang write a letter to Li Keyong to promptly receive the newly imperially commissioned defender, Lu Jianfang (盧簡方). Believing that Li Keyong would nevertheless reject Lu, however, the imperial government changed tactics and named Li Guochang the new military governor of Datong, believing that Li Keyong would not resist his father.

However, Li Guochang was hoping that he and Li Keyong would be allowed to retain two circuits, and therefore, when he received the transfer order, he tore up the edict and rose in rebellion as well, joining forces with Li Keyong. Initially, their joint forces were successful, capturing Zhelu Base (遮虜軍, in modern Xinzhou, Shanxi), and then defeating the joint forces of Cui Jikang (崔季康) the military governor of Hedong Circuit (河東, headquartered in modern Taiyuan, Shanxi) and Li Jun (李均) the military governor of Zhaoyi Circuit (昭義, headquartered in modern Changzhi, Shanxi) at Hong Valley (洪谷, in modern Xinzhou), killing Li Jun in battle. (The defeat of the Hedong forces also appeared to lead to a chain reaction of several mutinies at Hedong, in which Cui was killed, and his successor Li Kan (李侃) resigned; after Li Kan's resignation and the natural death of his successor Li Wei, the subsequent successor Li Shao (李邵) was deposed, and Li Shao's successor Kang Chuangui (康傳圭) was killed.)

By summer 880, however, the tide began to change against Li Keyong and his Shatuo forces. As the newly Tang-commissioned military governor of Datong, Li Zhuo (李涿), was joining forces with Li Keju the military governor of Lulong Circuit (盧龍, headquartered in modern Beijing) and the Tuyuhun chieftain Helian Duo against Li Keyong, Li Keyong left his officer Gao Wenji (高文集) in charge of his base at Shuo Prefecture (朔州, in modern Shuozhou, Shanxi) and stationed himself at Xiongwu Base (雄武軍, in modern Chengde, Hebei) to defend against Li Keju. Li Zhuo used this opportunity to entice Gao to surrender. Li Keyong tried to return to Shuo to recapture it, but was intercepted by Li Keju's officer Han Xuanshao (韓玄紹) and defeated, with Li Jinzhong and Cheng killed in battle. Meanwhile, Li Zhuo and Helian attacked Li Guochang at Yu Prefecture, defeating him. Both Li Guochang and Li Keyong were forced to abandon the region and flee to the Dada (達靼, then in the Yin Mountains region).

Helian was made the new defender of Datong, and he subsequently bribed the Dada chief, asking the Dada chief to put Li Guochang and Li Keyong to death. Li Keyong heard of this, but, pretending not to know about it, feasted with the Dada nobles. During the feast, he showed off his archery skills, such that he was even able to hit a leaf and a needle. He stated to the Dada nobles:

After the Dada nobles heard of his declaration that he did not wish to remain long, they gave up on the plan to kill him.

Contributions in defeating Huang Chao and establishment at Hedong By 881, Huang Chao had captured the imperial capital Chang'an, forcing Emperor Xizong to flee to Chengdu. Huang established a new state of Qi as its emperor. As part of the Tang operations against Huang's Qi state, the Shatuo generals Qu Zhen (瞿稹) and Li Youjin (李友金, a cousin of Li Guochang's) had gone to the Datong region to recruit soldiers for Tang, and while they were able to recruit some 30,000 soldiers, Qu and Li Youjin were having difficulty controlling them. Li Youjin then persuaded the eunuch monitor of the army in the region, Chen Jingsi (陳景思), to request Emperor Xizong to officially pardon Li Guochang and Li Keyong, so that he could ask them to join in the operation. Emperor Xizong did so, and Li Youjin subsequently went to Dada himself and brought Li Keyong back to Tang territory from Dada, along with 10,000 Dada soldiers.Zizhi Tongjian, vol. 254.

In summer, Li Keyong advanced south through Hedong Circuit, and he wrote then-military governor of Hedong, Zheng Congdang, requesting that Zheng supply his troops. Zheng, while not openly hostile to Li Keyong, was suspicious of him, and therefore closed the gates of Hedong's capital Taiyuan Municipality and refused to provide Li Keyong with anything more than limited supplies. Li Keyong responded by pillaging the Taiyuan region. Zheng then sought and received aid from Qibi Zhang (契苾璋) the military governor of Zhenwu, who launched Tuyuhun and Tujue soldiers to repel the Shatuo. Li Keyong was forced to withdraw north. He captured Xin (忻州, in modern Xinzhou) and Dai (present-day Daixian) Prefectures and made Dai his headquarters.

In spring 882, Li Keyong attacked Yu Prefecture. Qibi then requested imperial sanction and the cooperations of Datong and Tiande (天德, headquartered in modern Bayan Nur, Inner Mongolia) Circuits in operations against him. Emperor Xizong ordered Zheng to coordinate with Qibi. Meanwhile, Helian Duo and Li Keju engaged Li Keyong, but could not defeat him. Li Keyong also continued to pillage Hedong. Emperor Xizong had Wang Chucun the military governor of Yiwu Circuit (義武, headquartered in modern Baoding, Hebei), who was friendly with Li Keyong, write Li Keyong, informing him of imperial displeasure and suggesting that he cease his pillages and return to Shuo Prefecture.Zizhi Tongjian, vol. 255.

Meanwhile, though, Tang forces were still not able to expel Huang from the Chang'an region. Yang Fuguang, the eunuch monitor of the army in the Hezhong (河中, headquartered in modern Yuncheng, Shanxi) region, suggested to Wang Chongrong the military governor of Hezhong that another attempt be made to invite Li Keyong to join the operations against Huang. At Yang's suggestion, the overall commander of the operations, the former chancellor Wang Duo wrote both Li Keyong and Zheng, summoning Li Keyong while requesting that Zheng allow Li Keyong's Shatuo troops passage through Hedong. In winter 882, Li Keyong passed through Hedong without further hostilities. He was given the title of military governor of Yanmen Circuit (t s Yànmén Dào), controlling what is now northeastern Shanxi.

As Li Keyong arrived at Hezhong and prepared to cross the Yellow River to enter Huang's territory, Huang made an effort to befriend Li Keyong. As he knew that Li Keyong's brother Li Kerang had been previously killed by monks at a temple in the Qinling Mountains, he had Li Kerang's servant Hun Jintong (渾進通), who had submitted to Qi after Li Kerang's death, take an edict and many treasures from Huang to Li Keyong, and further delivered the monks responsible for Li Kerang's death to Li Keyong. Li Keyong executed the monks, but burned Huang's edict and distributed his treasure to the officers. He continued to advance into Huang's territory, stationing himself at Tong Prefecture (同州, in modern Weinan, Shaanxi) around the new year 883.

Li Keyong then continued his advance toward Chang'an, defeating Huang's brother Huang Kui (黃揆) on the way. He joined forces with those from Hezhong, Yiwu, and Zhongwu (忠武, headquartered in modern Xuchang, Henan) Circuits, and defeated the major Qi general Shang Rang. In summer 883, after he defeated Huang Chao near Chang'an, Huang Chao abandoned Chang'an and fled east. For his contributions, Emperor Xizong bestowed on him the honorary chancellor designation of Tong Zhongshu Menxia Pingzhangshi (同中書門下平章事). It was said that while he was the youngest of the Tang generals who fought with Huang (26 at the time), he had the greatest accomplishments. As one of his eyes was smaller than the other (and might have been blind), he was referred to as the "One-Eyed Dragon" (獨眼龍).

After the victory at Chang'an, Li Keyong returned to Yanmen, but was soon commissioned the military governor of Hedong, replacing Zheng. Knowing that the people of Hedong were still fearful of him after past hostilities, he posted many declarations throughout Hedong, stating, "Do not worry about the past. Just be comfortable in what you do." His father Li Guochang replaced him as the military governor of Yanmen under its new name Daibei Circuit (代北).