Liu Yin (劉隱) (874 – April 4, 911), formally Prince Xiang of Nanhai (南海襄王), later further posthumously honored Emperor Xiang (襄皇帝) with the temple name of Liezong (烈宗) by his younger brother Liu Yan, was a warlord late in the Chinese dynasty Tang Dynasty and Tang's succeeding dynasty Later Liang of the Five Dynasties and Ten Kingdoms period, who ruled Qinghai Circuit (清海, headquartered in modern Guangzhou, Guangdong) as its military governor (Jiedushi). It was on the basis of his rule that Liu Yan was later able to establish the state of Southern Han.
Liu Yin was born in 874, during the reign of Emperor Xizong of Tang. His father, whose name was variously referred to as Liu Qian or Liu Zhiqian, was a low-level officer at Guang Prefecture (廣州), the capital of Qinghai (then known as Lingnan East Circuit (嶺南東道)). His mother Lady Wei was a niece to Lingnan East's then-military governor Wei Zhou (韋宙). Liu Qian eventually came to control Feng Prefecture (封州, in modern Zhaoqing, Guangdong) as its prefect. Liu Yin was his oldest son, and he had two younger ones, Liu Tai (劉台), also born of Lady Wei, and Liu Yan, born of his concubine Lady Duan. (Lady Wei had killed Lady Duan out of a jealous rage after finding out about Lady Duan, whom Liu Qian had kept in a house away from their mansion. When Liu Qian subsequently buried Lady Duan, at her burial location was a stone tablet that bore the characters of Yin, Tai, and Yan, and he used those characters to name his three sons.)
In 894, Liu Qian died, and Liu Yin was observing a period of mourning when it was said that a group of about 100 soldiers and civilians were planning a disturbance. Liu Yin slaughtered them. Thereafter, then-military governor of Lingnan East, Liu Chonggui (劉崇龜), made him a Lingnan East officer and gave him one of the titles that Liu Qian held, the defender of Heshui Base (賀水鎮, in modern Nanning, Guangxi). Shortly after, Liu Chonggui commissioned him the prefect of Feng Prefecture.
In 896, a new military governor of the circuit (which had been renamed Qinghai by that point), Li Zhirou the Prince of Xue, commissioned by then-reigning Emperor Zhaozong (Emperor Xizong's brother and successor), was reporting to Qinghai. Instead of preparing to welcome him, however, the Qinghai officers Lu Ju (盧琚) and Tan Hongqi (譚弘玘) instead prepared to resist him and took up defensive positions, with Tan defending Duan Prefecture (端州, in modern Zhaoqing). Tan tried to enter an alliance with Liu Yin to defend against Li, and promised to give his daughter to Liu in marriage. Liu pretended to agree, but instead, under the guise that he was going to go to Duan Prefecture to marry Tan's daughter, ambushed Tan and killed him. He then attacked Guang Prefecture and killed Lu, and then welcomed Li to Guang Prefecture to take command. Li commissioned Liu as the commander of the Qinghai army (行軍司馬, Xingjun Sima).
In 898, Zeng Gun (曾袞) the prefect of Shao Prefecture (邵州, in modern Shaoguan, Guangdong) attacked Guang Prefecture, and was joined by the Guang Prefecture officer Wang Gui (王瓌, who commanded a fleet). Liu Yin defeated them, and when the Shao Prefecture officer Liu Tong (劉潼) subsequently attacked Zhen (湞州) and Han (浛州) (both in modern Qingyuan, Guangdong), Liu defeated and killed him.
In 900, Emperor Zhaozong commissioned the chancellor Xu Yanruo to replace Li Zhirou as military governor of Qinghai, but before Xu could get to Qinghai, Li died. When Xu arrived at Qinghai, he made Liu his deputy military governor and entrusted the affairs of the circuit to Liu. When Xu himself died in 901, he left a will recommending Liu as the acting military governor. Emperor Zhaozong subsequently commissioned Cui Yuan, but when Cui reached Jiangling, he heard that Qinghai was overrun by bandits and also feared that Liu would not yield authority to him, and therefore requested recall to the imperial government; Emperor Zhaozong agreed and did so, but did not name Liu military governor at that time.
In 902, Lu Guangchou the prefect of Qian Prefecture (虔州, in modern Ganzhou, Jiangxi) attacked Qinghai Circuit and captured Shao Prefecture and put Chao Prefecture (潮州, in modern Chaozhou, Guangdong) under siege, Liu defeated him and tried to recapture Shao. Liu Yan advised him not to, pointing out that Lu's army was still strong, but Liu Yin did not listen to him and attacked Shao anyway. At that time, the water level on the river was high, and Liu Yin was not able to get food supplies to the army on time. A counterattack by Lu and his officer Tan Quanbo defeated him and forced his withdrawal, allowing Lu to retain Shao.
In 904, by which time the powerful warlord Zhu Quanzhong the military governor of Xuanwu Circuit (宣武, headquartered in modern Kaifeng, Henan) was in effective control of the imperial government, having assassinated Emperor Zhaozong and replaced him with his son Emperor Ai, Liu Yin bribed Zhu and requested to be commissioned military governor. Zhu agreed, and Liu was subsequently given the military governorship.
In 905, Emperor Ai bestowed the honorary chancellor designation of Tong Zhongshu Menxia Pingzhangshi (同中書門下平章事) on Liu Yin.
In 907, Zhu Quanzhong forced Emperor Ai to yield the throne to him, ending Tang and starting a new Later Liang as its Emperor Taizu. He gave Liu Yin the greater honorary chancellor title of Shizhong (侍中) and created him the Prince of Dapeng.
In 908, Ma Yin the Prince of Chu to the north of Qinghai, sent his officer Lü Shizhou (呂師周) to attack Qinghai, capturing six prefectures (Zhao (昭州, in modern Guilin, Guangxi), He (賀州, in modern Hezhou, Guangxi), Wu (梧州, in modern Wuzhou, Guangxi), Meng (蒙州, in modern Wuzhou), Gong (龔州, in modern Guigang, Guangxi), and Fu (富州, in modern Hezhou)) from Qinghai.
Also in 908, Later Liang's Emperor Taizu sent the officials Zhao Guangyi (趙光裔) and Li Yinheng (李殷衡) as emissaries to Liu to commission him as the military governor of both Qinghai and Jinghai (靜海, headquartered in modern Hanoi, Vietnam) Circuits. Liu accepted the commissions but then detained Zhao and Li and did not permit them to return to the Later Liang court.
In 909, Emperor Taizu created Liu the Prince of Nanping.
In or sometime before 910, Liu Yin had sent Liu Yan to attack Ningyuan Circuit (寧遠, headquartered in modern Yulin, Guangxi), which consisted of its capital Rong Prefecture (容州) and Gao Prefecture (高州, in modern Maoming, Guangdong) and which was then governed by Pang Juzhao (龐巨昭), but Liu Yan was defeated by Pang. Still, believing that he could not prevail over Liu Yin, Pang surrendered Ningyuan to Chu in 910. Ma stationed his general Yao Yanzhang at Rong Prefecture. Later in the year, Emperor Taizu created Liu Yin the Prince of Nanhai.
In 911, Liu Yin fell ill. He submitted a recommendation that Liu Yan succeed him, and then died. Subsequently, Liu Yan took over the circuit.