Liu Bei 劉備 (161-222), courtesy name Xuande 玄德, posthumous imperial title Emperor Zhaolie of the Han dynasty 漢昭烈帝 and also known as the "First Ruler" (Xianzhu) of Shu 蜀先主 (r. 221-222), was the founder of one of the Three Empires 三國 (220-280), the state of Shu 蜀 or Shu-Han 蜀漢 (221-263) in the modern region of Sichuan.
In late imperial historiography, he is seen as the rightful successor of the Later Han dynasty 後漢 (25-220), of which Liu Bei was indeed a distant relative. The family Liu 劉 hailed from Zhuojun 涿郡 in northern China. Liu Bei nevertheless lived a very economic and austere life in the business of selling textiles and mats. In this profession he had contact to a lot of wealthy members of the gentry. During the later years of the reign of Emperor Ling 漢靈帝 (r. 167-188), he took part in the suppression of the Yellow Turban uprising 黃巾起義. He was rewarded, yet because of some differences with local officials he was stripped off his rank. He then became a follower of the warlord general Gongsun Zan 公孫瓚, whom he served in several campaigns. For his successes, he was appointed counsellor of the princedom of Yuanping 原平.
Liu Bei supported Tao Qian 陶謙 (132-194), regional governor (mu 牧) of Xuzhou 徐州 (approx. modern Jiangsu), against the armies of the powerful warlord Cao Cao 曹操 (155-220). When Tao Qian died, Liu Bei inherited his post. Liu Bei suffered defeat against two other warlords, Yuan Shu 袁術 (d. 199) and Lü Bu 呂布 (d. 198), a situation that forced him to become an ally with Cao Cao. The latter held Liu Bei in high esteem and appointed him regional governor of Yuzhou 豫州 (approx. modern Hubei). Liu Bei was involved in an assassination plot against Cao Cao, led by Emperor Xian's 漢獻帝 (r. 189-220) uncle Dong Cheng 董承. He therefore fled to Xuzhou and had to abandon his wife and children when he was heavily attacked by Cao Cao.
Liu Bei assembled a large army and offered his service to the powerful warlord of the east, Yuan Shao 袁紹 (d. 202), until the latter was defeated by Cao Cao in the battle of Guandu 官渡 (modern Zhongmou 中牟, Henan) in 200. Liu Bei had to flee again and to unite his remaining forces with that of Liu Biao 劉表 (142-208), who controlled the middle Yangtze region. Liu Bei's fame grow day by day, and he was able to attract large support by many members of the local gentry. When Cao Cao undertook a campaign against the tribal federation of the Wuhuan 烏桓 in the northeast, Liu Bei saw a chance to attack Cao Cao's stronghold in Xu 許 (modern Xuchang 許昌, Henan). Liu Biao refused to adopt this plan and died soon. Cao Cao thereupon advanced to the south, and Liu Biao's son Liu Cong 劉琮 submitted to the enemy.
Liu Bei fled yet again, and this time, he was able to win the support of his most important advisor, Zhuge Liang 諸葛亮 (181-234). Zhuge suggested allying with Sun Quan 孫權 (r. 222-252) who controlled the southeast, and the united armies were able to defeat Cao Cao at the Red Cliff (Chibi 赤壁, modern Puqi 蒲圻, Hubei) in 208. Liu Bei was able to conquer the provinces of central China. Liu Zhang 劉璋, regional governor of Yizhou 益州 (i.e. Shu 蜀, modern Sichuan), asked Liu Bei for support against Cao Cao who had invaded the northern parts of Shu in order to extinguish the the Daoist state of Zhang Lu 張魯 (d. 216).
Liu Bei became at odds with Liu Zhang and conquered the regional capital Chengdu 成都. In 220 Cao Cao again the region of Hanzhong in the north of Shu after Liu Bei had defeated and executed Cao Cao's general Xiahou Yuan 夏侯淵 (d. 219). Yet Liu Bei was able to repel Cao Cao's army and proclaimed himself king of Hanzhong. In the same year, Liu Bei's general Guan Yu 關羽 (d. 219), who was to control the middle Yangtze region died in battle, and the whole middle Yangtze region fell into the hands of Sun Quan. The territory in control of Liu Bei was thus reduced to the region of Shu.
With the support of competent advisors like Zhuge Liang and Zhang Fei 張飛 (d. 221), Liu Bei was able to defend this region against Sun Quan and Cao Cao. The three persons controlled China "like a three-legged kettle" (ding li 鼎立), as historiographers say. When Cao Cao's son Cao Pi 曹丕 (posthumous title Wei Wendi 魏文帝, r. 220-226) proclaimed the Wei dynasty 魏 (220-265), Liu Bei did the same in Shu, as emperor of the Han dynasty. To discern his short-lived empire from the great Han dynasty 漢 (206 BCE-220 CE), his empire is more often called Shu.
In the same year, Liu Bei planned to take revenge for the death of Guan Yu. His forces met with the army of Sun Quan at Yiling 夷陵 (modern Yichang 宜昌, Hubei), where a long static war took place. The troops of Shu, totally exhausted, were in the end utterly defeated by general Lu Xun 陸遜. During his retreat to Baidicheng 白帝城, Liu Bei fell sick and a year later. He entrusted his under-age son Liu Shan 劉禪 (posthumous title Houzhu 蜀後主 "The Last Ruler of Shu", r. 223-263) to the Counsellor-in-chief, Zhuge Liang.