Shu or Shu Han (221–263) was one of the three major states that competed for supremacy over China in the Three Kingdoms period (220–280). The state was based in the area around present-day Sichuan and Chongqing, which was historically known as "Shu" after an earlier state in Sichuan named Shu. "Shu Han" is therefore named after its location "Shu", and "Han" refers to the Han dynasty, because its founder, Liu Bei, was directly related to the imperial clan of the Han dynasty and shared the same surname—Liu—as the Han emperors.

From the territories he gained, Liu Bei established a position for himself in China during the final years of the Han dynasty. However, in 219, the alliance between Liu Bei and his ally, Sun Quan, was broken when Sun sent his general Lü Meng to invade Jing Province. Liu Bei lost his territories in Jing Province to Sun Quan. Guan Yu, the general guarding Liu Bei's assets in Jing Province, was captured and executed by Sun Quan's forces.

Cao Cao died in 220 and was succeeded by his son, Cao Pi, who forced the last Han ruler, Emperor Xian, to abdicate the throne in his favour. Cao Pi then established the state of Cao Wei and declared himself emperor. Liu Bei contested Cao Pi's claim to the throne and proclaimed himself "Emperor of Shu Han" in 221. Although Liu Bei is widely seen as the founder of Shu, he never claimed to be the founder of a new dynasty; rather, he viewed Shu as a continuation of the fallen Han dynasty.

Liu Bei ruled as emperor for less than three years. In 222, he launched a campaign against Sun Quan to retake Jing Province and avenge Guan Yu, culminating in the Battle of Xiaoting. However, due to grave tactical mistakes, Liu Bei suffered a crushing defeat at the hands of Sun Quan's general Lu Xun and lost the bulk of his army. He survived the battle and retreated to Baidicheng, where he died from illness a year later.

A Qing dynasty illustration of a battle between Wei and Shu at the banks of the Wei River. Many battles were fought between Shu and Wei in the Three Kingdoms period.

Liu Bei's son Liu Shan succeeded his father, making him the youngest of three rulers at only 16. Before his death, Liu Bei also appointed the chancellorZhuge Liang and the general Li Yan as regents to assist Liu Shan in managing the state affairs.

Zhuge Liang was the de facto head of the Shu government throughout Liu Shan's reign and was responsible for masterminding most of Shu's policies during his regency. When Liu Shan succeeded his father, Shu was the weakest of the three major powers. Following his father's defeat in 221, the portion of Jing Province previously held by Shu was now firmly under the control of Wu. Shu only included the western lands of Yi Province, while Wei controlled all of the northern lands, and Wu controlled all the lands from the east of Yi Province to the southern and eastern coastlines. This greatly limited Shu in terms of resources and manpower. As such, Zhuge Liang parleyed for peace with Wu, and reaffirmed the alliance between Sun Quan and Shu — with the former even recognising Sun Quan's legitimacy when the latter broke with Wei and declared himself "Emperor of Wu" in 229.

Zhuge Liang advocated an aggressive foreign policy towards Wei, because he strongly believed it was critical to the survival of Shu and its sovereignty. Between the years of 228 and 234, he launched a series of five military campaigns against Wei, with the aim of conquering Chang'an, a strategic city located on the road to the Wei capital, Luoyang. Most of the battles were fought around present-day Gansu and Shaanxi provinces. However, aside from gaining Jiang Wei as an officer in 228, Shu failed to achieve any significant victories or lasting gains in the five expeditions. During his final campaign, fought against the Wei general Sima Yi, an already taxed and ill Zhuge Liang died under the strain of the long stalemate with the Wei forces at the Battle of Wuzhang Plains.

The Shu government was then headed by Jiang Wan, Fei Yi and others after Zhuge Liang's death, and Shu temporarily ceased its aggression towards Wei. The Wei regent Cao Shuang launched an invasion of Hanzhong in 244. Despite being outnumbered 2-to-1, the Shu forces successfully defeated them at the Battle of Xingshi, with the humiliated Wei forces fleeing. Between 247 and 262, the Shu general Jiang Wei resumed Zhuge Liang's legacy by leading a series of nine military campaigns against Wei, but also failed to make any significant territorial gains.

In 263, armies led by the Wei generals Deng Ai and Zhong Hui attacked Shu and conquered its capital Chengdu without much struggle — the state having been exhausted by Jiang Wei's ill-fated campaigns. In the same year, Liu Shan surrendered to Deng Ai outside Chengdu, marking the end of Shu. In spite of this, Jiang Wei attempted to incite conflict between Deng Ai and Zhong Hui in the hope of taking advantage of the situation to revive Shu. Zhong Hui captured Deng Ai and openly rebelled against the Wei regent, Sima Zhao, but the revolt was suppressed by Wei forces. Jiang Wei, Zhong Hui and Deng Ai were killed in the struggle.

Liu Shan was brought to Luoyang, where he met with Sima Zhao and was awarded the title of "Duke of Anle". He lived a comfortable and peaceful life in Luoyang until the end of his days. It was claimed that many refugees fled west to Sasanian Persia when Shu fell in 263.[2]

Shu's population was not large enough to stand against the rival state of Wei.[3] Although the country could efficiently defend itself, Shu could not easily launch successful campaigns either. The first step to solving this was to launch an offensive against the Nanman in present-day Yunnan. This would secure more individuals for the army as well as more slaves. It would also gain control over trade with India.[3]

Shu was not merely a nation at war. During peace time, the Shu state began many irrigation and road-building projects designed to improve the economy. Many of these public works still exist and are widely used. For example, the Zipingpu Dam is still present near Chengdu, Sichuan. These works helped improve the economy of southwestern China and can be seen as the beginning of economic activity in Sichuan. It also promoted trade with southern China, which was then ruled by Eastern Wu.[citation needed]

Liu Shan was posthumously granted the title of "Duke Si of Anle" (安樂思公) by the Jin dynasty. He was later posthumously honoured as "Emperor Xiaohuai" (孝懷皇帝) by Liu Yuan, the founder of the Han Zhao state of the Sixteen Kingdoms. He was also referred to as the "Later Lord" (後主) in some historical texts.