The Hanzhong Campaign was a military campaign launched by the warlord Liu Bei to seize control of Hanzhong Commandery from his rival, Cao Cao. The campaign took place between December 217 and August 219 during the prelude to the Three Kingdoms period. Although Cao Cao's forces had settled in Hanzhong Commandery two years prior after the Battle of Yangping, they were worn out by an overall Fabian strategy employed by Liu Bei's forces, who used targeted attacks to capture strategic locations from the enemy. One of these attacks resulted in the death of Xiahou Yuan, one of Cao Cao's top generals, delivering a huge blow to the morale of Cao Cao's forces. Due to logistical and other issues, Cao Cao was eventually forced to abandon Hanzhong Commandery and order a retreat in June 219. Liu Bei emerged victorious in the campaign and occupied Hanzhong Commandery, after which he declared himself "King of Hanzhong" in August of that year.

The campaign would ultimately prove to be the final military campaign that Cao Cao participated in before his death in March 220.

Background

In April 215, Cao Cao attacked the warlord Zhang Lu in Hanzhong Commandery, defeating the latter at the Battle of Yangping. In December, Zhang Lu surrendered and Hanzhong Commandery came under Cao Cao's control.(會魯降,漢中平,) Sanguozhi vol. 9. Afterwards, Cao Cao appointed Pu Hu (), Du Huo () and Yuan Yue (袁約) as Administrators of the three Ba commanderies. But they were defeated by Huang Quan who then seized control of Badong (), Baxi () and Ba (巴) commanderies.(然卒破杜濩、朴胡,) Sanguozhi vol. 43.(九月,巴七姓夷王朴胡、賨邑侯杜濩舉巴夷、賨民來附,於是分巴郡,以胡為巴東太守,濩為巴西太守,皆封列侯。天子命公承制封拜諸侯守相。) Sanguozhi vol. 1.(權破公所署三巴太守杜濩、朴胡、袁約等。) Huayang Guo Zhi vol. 6.

On Liu Bei's side, he had also recently seized control of Yi Province (covering present-day Sichuan and Chongqing) from Liu Zhang in July 214, and was in the midst of a dispute with his ally Sun Quan over Jing Province (covering present-day Hubei and Hunan) in July 215. Liu Bei felt threatened when he received news that Hanzhong Commandery had fallen to Cao Cao, because Hanzhong was the northern "gateway" into Yi Province and he was now in danger of losing Yi Province to Cao Cao. Hence, Liu Bei came to a border treaty with Sun Quan, who had seized Changsha (), Guiyang () and Lingling () commanderies in southern Jing Province from him. Liu Bei demanded Lingling Commandery back. In return, he recognised Sun Quan's control over Changsha, Jiangxia () and Guiyang commanderies.(二十年,孫權以先主已得益州,使使報欲得荊州。先主言:「須得涼州,當以荊州相與。」權忿之,乃遣呂蒙襲奪長沙、零陵、桂陽三郡。先主引兵五萬下公安,令關羽入益陽。是歲,曹公定漢中,張魯遁走巴西。先主聞之,與權連和,分荊州、江夏、長沙、桂陽東屬,南郡、零陵、武陵西屬,引軍還江州。) Sanguozhi vol. 32.

Strategic difference In Hanzhong Commandery, Sima Yi(从讨张鲁,言于魏武曰:“刘备以诈力虏刘璋,蜀人未附而远争江陵,此机不可失也。今若曜威汉中,益州震动,进兵临之,势必瓦解。因此之势,易为功力。圣人不能违时,亦不失时矣。”) Jin Shu, vol.01 (biography of Sima Yi) and Liu Ye(汉中遂平。晔进曰:"明公以步卒五千,将诛董卓,北破袁绍,南征刘表,九州百郡,十并其八,威震天下,势慑海外。今举汉中,蜀人望风,破胆失守,推此而前,蜀可传檄而定。刘备,人杰也,有度而迟,得蜀日浅,蜀人未恃也。今破汉中,蜀人震恐,其势自倾。以公之神明,因其倾而压之,无不克也。若小缓之,诸葛亮明于治而为相,关羽、张飞勇冠三军而为将,蜀民既定,据险守要,则不可犯矣。今不取,必为后忧。" 太祖不从,...) Sanguozhi, vol.14 (biography of Liu Ye) urged Cao Cao to use the opportunity to attack Yi Province, but Cao Cao rejected the idea, saying to Sima Yi, "We should not be discontent. Now that we've already conquered Longyou (referring to present-day eastern Gansu), you're still longing about merging Shu (referring to Yi Province)!"(魏武曰:"人苦無足,既得隴右,複欲得蜀!") Jin Shu vol. 1. Cao Cao then left his generals Xiahou Yuan, Zhang He and Xu Huang behind to defend Hanzhong Commandery, and his Chief Clerk () Du Xi to oversee the commandery's military affairs.(以淵行都護將軍,督張郃、徐晃等平巴郡。太祖還鄴,留淵守漢中,即拜淵征西將軍。) Sanguozhi vol. 9.

In December 217, Liu Bei's adviser Fa Zheng analysed the reason Cao Cao left Xiahou Yuan to guard Hanzhong Commandery and didn't push to conquer Yi province was not because of a lack of strength or insight but because he met some internal problems and was needed back at the capital. Fa Zheng also believed that Xiahou Yuan and Zhang He's ability didn't match those of Liu Bei's commanders, so the pair could not defend Hanzhong Commandery. Hence, Fa Zheng urged Liu Bei to attack Hanzhong Commandery, stating three benefits if the commandery could be taken: ideally it could serve as a base of operations to attack Cao Cao and revive the Han dynasty; if that were not possible one could still attack Yong and Liang provinces from it and expand his territory; and finally Hanzhong Commandery had long-lasting strategical impact on the survival of Liu Bei's regime. Liu Bei agreed with Fa Zheng's analysis and ordered him to plan for the upcoming campaign.([建安]二十二年,正說先主曰:「曹操一舉而降張魯,定漢中,不因此勢以圖巴、蜀,而留夏侯淵、張郃屯守,身遽北還,此非其智不逮而力不足也,必將內有憂偪故耳。今策淵、郃才略,不勝國之將帥,舉衆往討,則必可克之,克之日,廣農積穀,觀釁伺隙,上可以傾覆寇敵,尊獎王室,中可以蠶食雍、涼,廣拓境土,下可以固守要害,為持乆之計。此蓋天以與我,時不可失也。」先主善其策,乃率諸將進兵漢中,正亦從行。) Sanguozhi vol. 37.

The campaign

Initial clashes

In December 217, Liu Bei's army advanced towards Yangping Pass (). At the same time, Liu Bei also sent Zhang Fei, Ma Chao, Wu Lan (), Lei Tong () and Ren Kui () to attack Wudu Commandery (), and they garrisoned at Xiabian County (). During this time, Leiding () of the Di ethnic group led seven tribes to join Liu Bei. As for Cao Cao's side, Xiahou Yuan defended Yangping Pass, Zhang He and Xu Huang respectively guarded Guangshi () and Mamingge (), while Cao Hong and Cao Xiu led a separate force to resist Zhang Fei, with Cao Xiu in a nominal advisory role but in practice sharing command by Cao Cao's order.(劉備遣將吳蘭屯下辯,太祖遣曹洪征之,以休為騎都尉,參洪軍事。太祖謂休曰:「汝雖參軍,其實帥也。」洪聞此令,亦委事於休。) Sanguozhi vol. 9.

In April 218, Zhang Fei and Ma Chao had garrisoned their forces at Gushan (), where they spread news that they would blockade Cao Hong's retreat route. Cao Hong was preparing to attack Wu Lan at Xiabian County, but some of the officers under his command were suspicious of Zhang Fei and Ma Chao's movements. Cao Xiu concluded that their movements were merely a ruse to lure their forces out, stating, "The enemy's real intention in cutting off the road is to ambush and advance stealthily. Now they are making a show of force first, which they cannot do. We should attack Lan before they are assembled. If Lan is captured, Fei will flee on his own."(備遣張飛屯固山,欲斷軍後。衆議狐疑,休曰:「賊實斷道者,當伏兵潛行。今乃先張聲勢,此其不能也。宜及其未集,促擊蘭,蘭破則飛自走矣。」洪從之,進兵擊蘭,大破之,飛果走。) Sanguozhi vol. 9. Cao Hong agreed to Cao Xiu's tactic and attacked in the third month. Lei Tong and Ren Kui were killed in battle, while Wu Lan fled to join the Di tribes, where he was subsequently killed by Qiangduan (), a Di leader of Yinping ().曹洪破吳蘭,斬其將任夔等。三月,張飛、馬超走漢中,陰平氐強端斬吳蘭,傳其首。) Sanguozhi vol. 1. After their subordinate's defeat, Zhang Fei and Ma Chao withdrew their army, just as Cao Xiu foresaw.

On another front, Liu Bei was facing Xiahou Yuan at Yangping Pass, with frequent skirmishes throughout the year.(二十三年,劉備軍陽平關,淵率諸將拒之,相守連年。) Sanguozhi vol.9. Between May and August (summer) 218, Liu Bei sent Chen Shi with over ten battalions to attack Mamingge, but the latter was defeated by Xu Huang, and some of the fleeing soldiers fell into the deep valleys during their escape.(備遣陳式等十餘營絕馬鳴閣道,晃別征破之,賊自投山谷,多死者。) Sanguozhi vol. 17. Liu Bei personally led a night assault on Zhang He at Guangshi with over 10,000 troops divided into ten divisions, but was unable to overcome his enemy.(劉備屯陽平,郃屯廣石。備以精卒萬餘,分為十部,夜急攻郃。郃率親兵搏戰,備不能克。) Sanguozhi vol. 17. He then sent an urgent letter to Zhuge Liang in Yi Province's capital, Chengdu, to request for reinforcements. Zhuge Liang vacillated and consulted Yang Hong (), who said, "Hanzhong is the throat of Yi Province. This is a critical point of survival and destruction. Without Hanzhong there will be no Shu (Yi Province). A disaster has befallen on the gates of our home. At this moment, the men should go to war, the women should help in transporting supplies, what's there to hesitate about sending reinforcements?"(漢中則益州咽喉,存亡之機會,若無漢中則無蜀矣,此家門之禍也。方今之事,男子當戰,女子當運,發兵何疑?) Sanguozhi vol. 41. Zhuge Liang accepted Yang Hong's advice and sent reinforcements to Liu Bei while Liu Bei continued his standoff against Cao Cao's forces.

Turn of the tide

By October 218, Cao Cao moved from Ye city to Chang'an near Hanzhong Commandery to direct the defence against Liu Bei, but had been held up by internal problems including a major coup d'état and some local uprisings. In the meantime, Liu Bei and Xiahou Yuan had been locked in a stalemate for a year. In February 219, to break the deadlock, Liu Bei crossed the Mian River () south of Yangping Pass and advanced towards Hanzhong Commandery through the mountains. Liu Bei's army set up camp at Mount Dingjun. In response, Xiahou Yuan and Zhang He led their forces out in an attempt to take control of higher ground, and they made camp at Zouma Valley (). During the night, Liu Bei set fire to the enemy camp fences. Xiahou Yuan led a force to defend the southern flank while sending Zhang He to guard the eastern side. Liu Bei launched a direct assault on Zhang He and Zhang started to falter, so Xiahou Yuan despatched half of his forces to support Zhang. At this point, Fa Zheng told Liu Bei that it was an opportune time to attack. Liu Bei ordered his men to shout loudly and beat the drums, and sent Huang Zhong to charge at the enemy. The mettlesome soldiers of Huang Zhong broke through the enemy lines and slew Xiahou Yuan and Zhao Yong, while Zhang He fled with his surviving troops to north of the Han River, where they set up a camp.([建安]二十四年正月,備夜燒圍鹿角。淵使張郃護東圍,自將輕兵護南圍。備挑郃戰,郃軍不利。淵分所將兵半助郃,為備所襲,淵遂戰死。) Sanguozhi vol. 9.(建安二十四年,於漢中定軍山擊夏侯淵。淵衆甚精,忠推鋒必進,勸率士卒,金鼓振天,歡聲動谷,一戰斬淵,淵軍大敗。) Sanguozhi vol. 36.(二十四年,先主自陽平南渡沔水,緣山稍前,於定軍、興勢作營。淵將兵來爭其地。正曰:「可擊矣。」先主命黃忠乘高鼓譟攻之,大破淵軍,淵等授首。) Sanguozhi vol. 37.(二十四年春,自陽平南渡沔水,緣山稍前,於定軍山勢作營。淵將兵來爭其地。先主命黃忠乘高鼓譟攻之,大破淵軍,斬淵及曹公所署益州刺史趙顒等。) Sanguozhi vol. 32.

As Cao Cao's forces had just lost their commander, Xiahou Yuan, a tempest ensued. Du Xi and Guo Huai regrouped their scattered troops and (unofficially) nominated Zhang He to replace Xiahou Yuan. Zhang He accepted and gave orders to his troops, restoring peace and order in his army. The following day, Liu Bei planned to cross the Han River and attack Zhang He, whose officers pointed out they were outnumbered, and suggested to Zhang He to set up camps along the banks of the Han River.(其明日,备欲渡汉水来攻。诸将仪众寡不敌,备便乘胜,欲依水为陈以拒之。) Sanguozhi vol. 26. Guo Huai felt that their forces were displaying weakness to the enemy by doing so, he proposed setting up camp far away from the river to lure the enemy to cross the shallow, during which they counterattack the enemy.(淮曰:“此示弱而不足挫敌,非算也。不如远水为陈,引而致之,半济而后击,备可破也。”既陈,备疑不渡,淮遂坚守,示无还心。) Sanguozhi vol. 26. Zhang He agreed with Guo Huai's idea and moved his camp further away from the river. Liu Bei became suspicious and did not dare to cross the river.(旣陣,備疑不渡,淮遂堅守,示無還心。) Sanguozhi vol. 26. In Chang'an, when Cao Cao heard that Xiahou Yuan had been killed in action, he dispatched Cao Zhen with an army to reinforce their forces at Yangping Pass. When Cao Zhen arrived, he directed Xu Huang to attack Gao Xiang, an officer under Liu Bei. Xu Huang scored a victory and temporarily restored some morale for Cao Cao's side.(是時,夏侯淵沒於陽平,太祖憂之。以真為征蜀護軍,督徐晃等破劉備別將高詳於陽平。) Sanguozhi vol. 9.

Last stages

In April 219, Cao Cao personally led an army from Chang'an to Hanzhong Commandery via Xie Valley (). Liu Bei was not worried, as he thought, "Even if Cao Cao came, he cannot do anything. I'll definitely take control of the Han River." Hence, Liu Bei gathered his forces and put up a firm defence, refusing to engage Cao Cao's army in a major confrontation. Liu Bei focused on a war of attrition from this point forward. As the months pass by stuck in this deadlock, more and more of Cao Cao's soldiers either died or deserted.(及曹公至,先主斂眾拒險,終不交鋒,積月不拔,亡者日多。) Sanguozhi vol. 32.