The Han–Xiongnu War, also known as the Sino–Xiongnu War, was a series of military conflicts fought over two centuries (from 133 BC to 89 AD) between the Chinese Han Empire and the nomadic Xiongnu confederation, although extended conflicts can be traced back as early as 200 BC and ahead as late as 188 AD.
 The Chinese civilization initially clashed with nomadic tribes that would later become the Xiongnu confederation during the Warring States period, and various northern states built elongated fortifications (which later became the Great Wall) to defend against raids from the Mongolian Plateau. The unified Qin dynasty, who conquered all other states under the First Emperor, dispatched General Meng Tian in 215 BC in a successful campaign to expel the Xiongnu from the Ordos region. However, the subsequent civil wars following Qin dynasty's collapse gave the Xiongnu tribes, who were then unified into a large confederacy under Modu Chanyu, the opportunity to reinvade the Ordos region.  After the Western Han dynasty was established in 202 BC, Emperor Gao tried to fight off Xiongnu invasions but had himself trapped in an ambush during the Battle of Baideng, and a truce was negotiated. Decades of de jure "peace" then ensued then followed with the Chinese gifting "marriage alliance" to appease the Xiongnu, who still raided Chinese borderlands routinely.
 However, starting from the reign of the seventh Han ruler, Emperor Wu, the Han Empire began to change from a relatively passive foreign policy to a proactively offensive strategy seeking to permanently remove the northern threat. The tension fully escalated in 133 BC when the Han army unsuccessfully tried to ambush Xiongnu raiders at Mayi, and retaliatory raids intensified. Emperor Wu then started deploying newer generations of military commanders and launched several expeditions to control the Ordos Loop, Hexi Corridor and Western Regions, eventually pushing the Xiongnu north beyond the Gobi Desert with a decisive campaign in 119 BC. After the death of Emperor Wu in 87 BC, the war winded down to mostly smaller border conflicts, although Emperor Xuan and Yuan had each sanctioned major offensives against the Xiongnu during their reigns.  The overall strategic Han successes against the Xiongnu allowed the Chinese to project their influence deeply into Central Asia, which eventually led to the establishment of a regional protectorate in 60 BC. For the Xiongnu, the situation deteriorated with each setback, leading to erosion of the chanyu's prestige and dominance, and the subsequent internal power struggles further weakened the confederation, fracturing it into various self-ruling factions. Han Empire then began adhere to a divide and rule strategy, using marriage alliances (such as that of Wang Zhaojun to Huhanye) to recruit some against others.
 During the interregnum Xin dynasty, Wuzhuliu chanyu waged war in 11 AD after Wang Mang, who usurped the Han throne, attempted to split the Xiongnu by instating 15 new chanyu. Wang Mang mobilized 300,000 troops against Xiongnu and forced Goguryeo, Wuhuan and various Western Regions city-states to send conscripts and provisions, which led to the mass defection of these vassal states. After the Eastern Han dynasty was established in 25 AD, the Chinese initially found their hands full after the chaotic civil war and could not afford any full-scale mobilizations against the Xiongnu raids, therefore resorted to continue lobbying among different Xiongnu faction rulers instead. This continued for another two decades until 46 AD, when repeated natural disasters severely weakened the Xiongnu and forced them to flee north from an attack by Wuhuan.  Xiongnu then permanently split in 48 AD into two groups, known as the Northern and Southern Xiongnu, respectively. The Southern Xiongnu eventually submitted to the Han Empire and became auxiliaries/mercenaries against the Northern Xiongnu, who continued to resist and was eventually evicted westwards by the further expeditions by the Han Empire and its vassals, as well as the rise of other hostile Donghu states like Xianbei. In 89 AD, General Dou Xian led 50,000 cavalries on an expedition that decisively defeated the Northern Xiongnu main force, causing it to split further. In 91 AD, Northern Chanyu was defeated in the Battle of the Altai Mountains, and the Northern Xiongnu fled west into Dzungaria, where they continued causing sporadic troubles until 151 AD when a 4,000-strong Han militia was enough to defeat them, causing them to flee further west into Central Asia and since disappeared from historical records. Southern Xiongnu, on the other hand, continued cycles of "rebel then resubmit" under the Eastern Han dynasty til as late as the Yellow Turban Rebellion, but from 89 AD onwards the Han Empire's main concern had already switched to the Qiang people, who had become an increasingly bigger headache than the Xiongnu.
 During the Warring States period, the Qin, Zhao, and Yan states conquered various nomadic territories inhabited by the Xiongnu and other Hu peoples. They strengthened their new frontiers with elongated wall fortifications. By 221 BC, the Qin ended the chaotic Eastern Zhou period by conquering all other states and unifying China proper. In 215 BC, Qin Shi Huang ordered General Meng Tian to set out against the Xiongnu tribes, situated in the Ordos region, and establish a frontier region at the Ordos Loop. Believing that the Xiongnu were a possible threat, the emperor launched a pre-emptive strike against the Xiongnu with the intention of expanding his empire. Later that year (215 BC), General Meng Tian succeeded in defeating the Xiongnu and driving them from the Ordos region, seizing their territory as result. After the catastrophic defeat at the hands of Meng, Touman Chanyu and his followers fled far into the Mongolian Plateau. Fusu (Prince of Qin) and General Meng Tian were stationed at a garrison in Suide and soon began the construction of the walled defences, connecting them with the old walls built by Qin, Yan and Zhao states. The fortified walls ran from Liaodong to Lintao, thus enclosing the conquered Ordos region, safeguarding the Qin empire against the Xiongnu and other northern nomadic people. Due to the northward expansion, the threat that the Qin empire posed to the Xiongnu ultimately led to the state formation of the many tribes towards a confederacy.
 However, after the sudden death of Qin Shi Huang, the ensuing political corruption and chaos during the short reign of Qin Er Shi would lead to various anti-Qin rebellions, eventually bringing about the collapse of the Qin dynasty. A massive civil war then erupted between various reinstated states, with Liu Bang eventually victorious to establish the Han dynasty. During the transitional years between Qin and Han, while the Chinese were mainly focused towards the interior of their nation, the Xiongnu took the opportunity to retake the territory north of the wall. The Xiongnu frequently led incursions to the Han frontier and had considerable political influence over the border regions. In response, Emperor Gaozu led a Han army against the Xiongnu in 200 BC, pursuing them as far as Pingcheng (present-day Datong, Shanxi) before being ambushed by Modu Chanyu's cavalry. His encampment was encircled by the Xiongnu, but Emperor Gaozu escaped after seven days. After realizing that a military solution was not feasible for the time being, Emperor Gaozu sent Liu Jing to negotiate peace with Modu Chanyu. In 198 BC, a marriage alliance was concluded between the Han and the Xiongnu, but this proved far from effective as the incursions in the frontier regions continued.
 By the reign of Emperor Wu, the Han empire was prospering and the national treasury had accumulated large surpluses. However, burdened by the frequent Xiongnu raids at the frontier of the Han empire, the emperor abandoned the policies of his predecessors to maintain peace with the Xiongnu early in his reign. In 136 BC, after continued Xiongnu incursions near the northern frontier, Emperor Wu had a court conference assembled. The faction supporting war against the Xiongnu was able to sway the majority opinion by making a compromise for those worried about stretching financial resources on an indefinite campaign: in an engagement along the border near Mayi, Han forces would lure Junchen Chanyu over with wealth and promises of defections in order to eliminate him and cause political chaos for the Xiongnu. Emperor Wu launched his military campaigns against the Xiongnu in 133 BC.
 In 133 BC, the Xiongnu forces led by the Chanyu were lured into a trap at Mayi, while a Han army of about 300,000 troops laid in ambush against the Xiongnu. Wang Hui (王恢) led this campaign and commanded a force of 30,000 men strong, advancing from Dai with the intention of attacking the Xiongnu supply route. Han Anguo (韓安國) and Gongsun He (公孫賀) commanded the remaining forces and advanced towards Mayi. Junchen Chanyu led his army of 100,000 men towards Mayi, but he became increasingly suspicious of the situation. When the ambush failed, because Junchen Chanyu realized he was about to fall into a trap and fled back north, the peace was broken and the Han court resolved to engage in full-scale war. In light of this battle, the Xiongnu became aware of the Han court's intentions to go to war. By that point the Han empire was long consolidated politically, militarily, and economically, and was led by an increasingly pro-war faction in the imperial court.
 In the autumn of 129 BC, a Han force of 40,000 cavalrymen launched a surprise attack against the Xiongnu in the frontier markets, where masses of Xiongnu people visited to trade. In 128 BC, General Wei Qing led 30,000 men to battle at the regions north of Yanmen and came out victorious. The next year (127 BC), the Xiongnu invaded Liaoxi, killing its governor, and advanced towards Yanmen. Han Anguo mobilized 700 men, but was defeated and withdrew to Yuyang. Thereafter, Wei Qing moved out with a force and captured some Xiongnu troops, causing the main force of the Xiongnu to withdraw. Meanwhile, Li Xi had led a force across the frontier and also captured some of the Xiongnu troops.
 Between 127 and 119 BC, Emperor Wu ordered the generals Wei Qing and Huo Qubing to lead several large-scale military campaigns against the Xiongnu. Leading campaigns involving tens of thousands of troops, General Wei Qing captured the Ordos Desert region from the Xiongnu in 127 BC and General Huo Qubing expelled them from the Qilian Mountains in 121 BC, gaining the surrender of many Xiongnu aristocrats. The Han court also sent expeditions, ranging to over 100,000 troops, into Mongolia in 124 BC, 123 BC, and 119 BC, attacking the heart of Xiongnu territory. Following the successes of these 127–119 BC campaigns, Emperor Wu wrote edicts in which he heavily praised the two generals for their achievements.
 In 127 BC, General Wei Qing invaded and retook full control of the Ordos region. Earlier that year, he had departed from Yunzhong towards Longxi to invade the Xiongnu in Ordos. After the conquest, about 100,000 people resettled in the Ordos. In the region, two commanderies were established, Wuyuan and Shuofang. With the old Qin walled fortifications in their control, the Han set out to repair and extend the walls. In 126 BC, the Xiongnu sent out three forces of 30,000 troops each to raid Dai, Dinxiang, and Shang. In that same year (126 BC), General Wei Qing advanced from Gaoque into Mongolia with 30,000 men and inflicted defeat to the Xiongnu forces of the Tuqi King and captured 15,000 men along with 10 tribal chiefs. In the autumn of 126 BC, the Xiongnu raided Dai once again; they took some prisoners and killed a Han military commander.
 During the spring of 123 BC, General Wei Qing set off to Mongolia with an army to attack the Xiongnu; they marched back victorious to Dingxiang. Two months later, the Han army advanced towards the Xiongnu again, but this time the Xiongnu were prepared for the invasion by the Han forces. However, hereafter, due to the military expeditions that the Han empire undertook, the Xiongnu moved their capital and retreated to the far northern regions of the Gobi Desert.
 In the Battle of Hexi (121 BC), the Han forces had inflicted a major defeat to the Xiongnu. Emperor Wu desired to place firm control over the Hexi Corridor and decided to launch a large military offensive to purge the Xiongnu from the area. The campaign was undertaken in 121 BC by General Huo Qubing. Departing from Longxi that year, General Huo Qubing led light cavalry through five Xiongnu kingdoms, conquering the Yanzhi and Qilian mountain ranges from the Xiongnu.
 In the spring of 121 BC, Huo set out from Longxi and advanced into the territory of the Xiutu King (休屠王), beyond the Yanzhi Mountains. About 18,000 Xiongnu cavalry were captured or killed.
 That summer (121 BC), Huo advanced into the Anshan Desert to invade the regions at the Qilian Mountains. At the Qilian Mountains, the Hunye King (渾邪王) saw the deaths of over 30,000 troops in battle against the Han, while 2800 of his troops were captured.
 Distraught by the huge losses and fearing the wrath of the Xiongnu Chanyu, the Xiutu King and the Hunye King planned to surrender to the Han forces of General Huo Qubing. However, the Xiutu King suddenly changed his mind and fled with his followers. General Huo Qubing and the Hunye King gave chase and killed Xiutu and his 8000 troops. In the end, the Hunye King and 40,000 Xiongnu soldiers surrendered, which also led to the Xiongnu tribes of Hunye and Xiutu submitting to the rule of the Han empire. Due to the series of victories, the Han had conquered a territory stretching from the Hexi Corridor to Lop Nur, thus cutting the Xiongnu off from their Qiang allies. In 111 BC, a major Qiang–Xiongnu allied force was repelled from the Hexi Corridor. Hereafter, four commanderies were established in the Hexi Corridor—Jiuquan, Zhangye, Dunhuang, and Wuwei—which were populated with Han settlers.
 The Battle of Mobei (119 BC) saw Han forces invade the northern Gobi Desert, as well as areas north of the Gobi. In 119 BC, two separate expeditionary forces led by the Han generals Wei Qing and Huo Qubing mobilized towards the Xiongnu. The two generals led the campaign to the Khangai Mountains and the Orkhon Valley, where they forced the Chanyu to flee north of the Gobi Desert. The two forces together comprised 100,000 cavalrymen, 140,000 horses, and few hundred thousand infantry. They advanced into the desert in pursuit of the main force of the Xiongnu. The military campaign was a major Han military victory against Xiongnu, where the Xiongnu were driven from the Gobi Desert. The Xiongnu casualties ranged from 80 to 90 thousand troops, while the Han casualties ranged from 20 to 30 thousand troops. In the aftermath, the Han forces had lost around 100,000 horses during the campaign.
 During this campaign, Huo Qubing's elite troops had set off from Dai to link up with Lu Bode's forces in Yucheng, after which they advanced further and engaged the Tuqi King of the Left and his army. Huo Qubing's army encircled and overran their enemy, killing around 70,000 Xiongnu, including the Tuqi King of the Left. He then went on to conduct a series of rituals upon arrival at the Khentii Mountains to symbolize the historic Han victory, then continued his pursuit as far as Lake Baikal.
 Wei Qing's army, setting off from Dingxiang, encountered Yizhixie Chanyu's army. Wei Qing ordered his troops to arrange heavy-armoured chariots in a ring formation, creating mobile fortresses that provided archers, crossbowmen, and infantry protection from the Xiongnu's cavalry charges, and allowing the Han troops to utilize their ranged weapons' advantages. A 5000-strong cavalry was deployed to reinforce the array against any Xiongnu attack. The Xiongnu charged the Han forces with a 10,000-strong vanguard cavalry. The battle solidified into a stalemate until dusk, when a sandstorm obscured the battlefield. Subsequently, Wei Qing sent in his main forces and overwhelmed the Xiongnu. The Han cavalry used the low visibility as cover and encircled the Xiongnu army from both flanks, but Yizhixie Chanyu and a contingent of troops broke through and escaped.
 With the Han conquest of the Hexi Corridor in 121 BC, the city-states at the Tarim Basin were caught in between the onslaught of the war, with much shifting of allegiance. There were several Han military expeditions undertaken to secure the submission of the local kings to the Han empire; the Han took control of the regions for strategic purposes while the Xiongnu needed the regions as a source of revenue. Due to the ensuing war with the Han empire, the Xiongnu were forced to extract more crafts and agricultural foodstuffs from the Tarim Basin urban centres. By 115 BC, the Han had set up commanderies at Jiuquan and Wuwei, while extending the old Qin fortifications from Lingju to the area west of Dunhuang. From 115 to 60 BC, the Han and Xiongnu competed for control and influence over these states, which saw the rise of power of the Han empire over eastern Central Asia with the decline of that of the Xiongnu's. The Han empire brought the states of Loulan, Jushi (Turfan), Luntai (Bügür), Dayuan (Ferghana), and Kangju (Soghdiana) into tributary submission between 108 and 101 BC. The long-walled defence line that now stretched all the way to Dunhuang protected the people, guided caravans and troops to and from Central Asia, and served to separate the Xiongnu from their allies, the Qiang people.
 In 115 BC Zhang Qian was once again dispatched to the Western Regions to secure military alliances against the Xiongnu. He sought out the various states in Central Asia, such as the Wusun. He came back without achieving his goals, but he gained valuable knowledge about the Western Regions like in his previous travels. Emperor Wu received reports from Zhang about the large and powerful horses of Ferghana. These horses were known as "heavenly horses" or "blood-sweating horses". Zhang brought back some of these horses to the Han empire. The emperor thought that the horses were of high importance to fight the Xiongnu. The refusal of the Dayuan kingdom, a nation centred in Ferghana, to provide the Han empire with the horses and the execution of a Han envoy led to conflict; the Han forces brought Dayuan into submission in 101 BC. The Xiongnu, aware of this predicament, had tried to halt the Han advance, but they were outnumbered and suffered defeat.
 General Zhao Ponu (趙破奴) was sent on an expedition in 108 BC to invade Jushi (Turfan), a critical economic and military stronghold of the Xiongnu in the Western Regions. After he conquered the region, the Han forces repelled all Xiongnu attacks to regain control over Jushi. When King Angui acceded the throne of Loulan, the kingdom—which was the easternmost state of the Western Regions—became increasingly apprehensive towards the Han. Their policies became somewhat anti-Han in nature and supportive towards the Xiongnu, such as allowing the killing of passing Han envoys to happen and revealing Han military logistics. In 77 BC, King Angui received the Han emissary Fu Jiezi and held a banquet for the envoy, who came under the guise of bringing many coveted gifts. During the banquet, Fu Jiezi requested a private discussion with King Angui, which was a pretence for the assassination of the Loulan ruler by two of Fu Jiezi's officers. Amid the cries of horror, Fu Jiezi proclaimed an admonition to the Loulan aristocracy and beheaded the dead king. The Han court informed Weituqi—who was an ally of the Han—of his brother's death, had him escorted back from Chang'an to Loulan, and installed him as the new monarch of the kingdom, which was renamed Shanshan. Thereafter, the royal seat was relocated to the southern parts of Shanshan (present-day Kargilik or Ruoqiang), outside the sphere of Xiongnu influence.
 The Xiongnu practised marriage alliances with Han dynasty officers and officials who defected to their side. The older sister of the Chanyu (the Xiongnu ruler) was married to the Xiongnu General Zhao Xin, the Marquis of Xi who was serving the Han dynasty. The daughter of the Chanyu was married to the Han Chinese General Li Ling after he surrendered and defected. The Yenisei Kirghiz Khagans claimed descent from Li Ling. Another Han Chinese General who defected to the Xiongnu was Li Guangli who also married a daughter of the Chanyu.
 Due to the many losses inflicted on the Xiongnu, rebellion soon broke out and former enslaved people rose up in arms. Around 80 BC, the Xiongnu attacked the Wusun in a punitive campaign and soon the Wusun monarch requested military support from the Han empire. In 72 BC, the joint forces of the Wusun and Han invaded the territory of the Luli King of the Right. Around 40,000 Xiongnu people and many of their livestock were captured before their city was sacked after the battle. The very next year, various tribes invaded and raided the Xiongnu territory from all fronts; Wusun from the west, Dingling from the north, and Wuhuan from the east. The Han forces had set out in five columns and invaded from the south. According to Hanshu, this event marks the beginning of Xiongnu decline and the dismantlement of the confederation.
 As the Xiongnu economic and military situation deteriorated, the Xiongnu were willing to renew peace during the reigns of Huyandi Chanyu (r. 85–69 BC) and Xulüquanqu Chanyu (r. 68–60 BC), but the Han court gave only one option, tributary submission. After Xulüquanqu Chanyu's death in 60 BC, a  Xiongnu civil war broke loose in 57 BC over the succession, which fully fragmented the Xiongnu confederation with many contenders. In the end, only Zhizhi Chanyu and Huhanye Chanyu survived the struggle to power. After Zhizhi Chanyu (r. 56–36 BC) had inflicted serious losses against his rival Huhanye Chanyu (r. 58–31 BC), Huhanye and his supporters debated whether to request military protection and become a Han vassal. In 53 BC, Huhanye decided to do so and surrendered to the reign of the Han empire.
 General Chen Tang and Protector General Gan Yanshou, acting without explicit permission from the Han court, killed Zhizhi Chanyu at his capital city (present-day Taraz, Kazakhstan) in 36 BC. Taking the initiative, Chen Tang had forged an imperial decree, which led to the mobilization of 40,000 troops in two columns. The Han forces besieged and defeated the forces of Zhizhi Chanyu, and afterwards beheaded him. His head was sent to the Han capital Chang'an. On return to Chang'an, the two officers faced legal enquiries for forging a decree, but were pardoned. Chen and Gan received modest rewards, although the Han court was reluctant to do so due to the precedent that this event set.
 In 9 AD, the Han official Wang Mang usurped the Han throne and proclaimed a new Chinese dynasty, known as Xin. He regarded the Xiongnu as lowly vassals and relations rapidly deteriorated. During the winter 10 to 11 AD, Wang amassed 300,000 troops along the northern frontier, which forced the Xiongnu to back down from launching large-scale attacks. Although Han rule was restored in August 25 AD by Emperor Guangwu, its grip over the Tarim Basin had weakened. The Xiongnu had namely taken advantage of the situation and gained control over the Western Regions.
 The first half of the 1st century BC witnessed several succession crises for the Xiongnu leadership, allowing the Han empire to reaffirm its control over the Western Regions. Huduershi Chanyu was succeeded by his son Punu (蒲奴) in 46 AD, thus breaking the late Huhanye's orders that only a Xiongnu ruler's brother was a valid successor. Bi (比), the Rizhu King of the Right and Huduershi's nephew, was outraged and was declared a rival Chanyu by eight southern Xiongnu tribes in 48 AD. The Xiongnu confederation fell apart in the Northern Xiongnu and Southern Xiongnu, and Bi submitted to the reign of the Han empire in 50 AD. The Han took control of the Southern Xiongnu under Bi, which had 30–40 thousand troops and a population of roughly twice or thrice the size.
 Between 73 and 102 AD, General Ban Chao led several expeditions in the Tarim Basin, re-establishing Han control over the region. At the capital of Shanshan by Lop Nur, Ban Chao and a small party of his men slaughtered a visiting Northern Xiongnu embassy to Shanshan. Ban Chao presented their heads to King Guang of Shanshan, who was overwhelmed by the ordeal, whereupon he sent hostages to Han. When Ban Chao traveled further to Yutian (Khotan), King Guangde received him with little courtesy. The king's soothsayer told the king that he should demand Ban Chao's horse, so Ban Chao killed the soothsayer for the insult. Impressed by the ruthlessness that he witnessed, the king killed a Xiongnu agent and offered submission to Han. Going further westward, Ban Chao and his party arrived at Shule. Earlier, King Jian of Qiuci had deposed the former king and replaced him with his officer Douti. In 74 AD, Ban Chao's forces captured King Douti of Kashgar (Shule 疏勒), both a puppet of Kucha (Qiuci 龜玆) and an ally of the Xiongnu. Local opponents to the new regime had offered support to the Han. Tian Lü (Ban Chao's officer) took Douti captive and Ban Chao put Zhong (a prince of the native dynasty) on the throne. Ban Chao, insisting on leniency, send Douti back to Qiuci unharmed.
 In 73 AD, General Dou Gu and his army departed from Jiuquan and advanced towards the Northern Xiongnu, defeating the Northern Xiongnu and pursuing them as far as Lake Barkol before establishing a garrison at Hami. In 74 AD, Dou Gu retook Turfan from the Xiongnu. The Han campaigns resulted in the retreat of the Northern Xiongnu to Dzungaria, while Ban Chao was threatening and bringing the city-states at the Tarim Basin to submission under the Han empire once again. In 74 AD, the King of Jushi submitted to the Han forces under General Dou Gu as the Xiongnu were unable to engage the Han forces.
 Later in the year (74 AD), the kingdoms of Karasahr (Yanqi 焉耆) and Kucha were forced to surrender to the Han empire. Although Dou Gu was able to evict the Xiongnu from Turfan in 74 AD, the Northern Xiongnu soon invaded the Bogda Mountains while their allies from Karasahr and Kucha killed the Protector General Chen Mu and his men. As a result, the Han garrison at Hami was forced to withdraw in 77 AD, which was not reestablished until 91 AD.
 In 89 AD, General Dou Xian led a Han expedition against the Northern Xiongnu. The army advanced from Jilu, Manyi, and Guyang in three great columns. In the summer of 89, the forces—comprising a total of 40,000 troops—assembled at Zhuoye Mountain. Near the end of the campaign, Dou's forces chased the Northern Chanyu into the Altai Mountains, killing 13,000 Xiongnu and accepting the surrender of 200,000 Xiongnu from 81 tribes. A light cavalry of 2000 was sent towards the Xiongnu at Hami, capturing the region from them.  General Dou Xian marched with his troops in a triumphal progress to the heartland of the Northern Xiongnu's territory and engraved an inscription commemorating the victory on Mount Yanran, before returning to Han. The Han victory in the campaign of 89 AD resulted in the destruction of the Xiongnu state. In 2017, a joint Sino-Mongolian archaeological expedition rediscovered the Inscription of Yanran in the Khangai Mountains of central Mongolia.
 In 90 AD, General Dou Xian had encamped at Wuwei. He sent Deputy Colonel Yan Pan with 2000 light cavalry to strike down the final Xiongnu defenses in the Western Regions, capturing Yiwu and receiving the surrender of Jushi. Major Liang Feng was dispatched to capture the Northern Chanyu, which he did, but he was forced to leave him behind as Dou Xian had already broken camp and returned to China. In the tenth month of 90 AD, Dou Xian sent Liang Feng and Ban Gu to help the Northern Chanyu make preparations for his planned travel as he wished to submit to the Han court in person the following month.
 However, this never came to be as Dou Xian dispatched General Geng Kui and Shizi of the Southern Xiongnu with 8000 light cavalry to attack the Northern Chanyu, encamped at Heyun (河雲), in 90 AD. Once the Han forces arrived at Zhuoye Mountains, they left their heavy equipment behind to launch a swift pincer movement towards Heyun. Geng Kui attacked from the east via the Khangai Mountains and Ganwei River (甘微河), while Shizi attacked from the west via the Western Lake (西海). The Northern Chanyu—said to be greatly shocked by this—launched a counterattack, but he was forced to flee as he left his family and seal behind. The Han killed 8000 men and captured several thousands. In 91 AD, General Geng Kui and Major Ren Shang with a light cavalry of 800 advanced further via the Juyan Gol (Juyansai) into the Altai Mountains, where the Northern Chanyu had encamped. At the Battle of Altai Mountains, they massacred 5000 Xiongnu men and pursued the Northern Chanyu until he escaped to an unknown place. By 91 AD, the last remnants of the Northern Xiongnu had migrated west towards the Ili River valley.
 The Southern Xiongnu—who had been situated in the Ordos region since about 50 AD—remained within the territory of the Han empire as semi-independent tributaries. They were dependent to the Han empire for their livelihood as indicated by a memorial from the Southern Chanyu to the Han court in 88 AD. Following the military successes against the Xiongnu, General Ban Chao was promoted to the position of Protector General and stationed in Kucha in 91 AD. At the remote frontier, Ban Chao reaffirmed absolute Han control over the Western Regions from 91 AD onwards.
 Chao Cuo was one of the first known ministers to suggest to Emperor Wen that Han armies should have a cavalry-centric army to counter the nomadic Xiongnu to the north, since Han armies were still primarily infantry with cavalries and chariots playing a supporting role. He advocated the policy of "using barbarians to attack barbarians", that is, incorporating surrendered Xiongnu and other nomadic tribes into the Han military, a suggestion that was eventually adopted, especially with the establishment of dependent states of different nomads living on the Han empire's frontiers.
 In a memorandum entitled Guard the Frontiers and Protect the Borders that he presented to the throne in 169 BC, Chao compared the relative strengths of Xiongnu and Han battle tactics. In regards to the Han armies, Chao deemed the Xiongnu horsemen better prepared for rough terrain due to their better horses, better with horseback archery, and better able to withstand the elements and harsh climates. However, on level plains, he regarded Xiongnu cavalry inferior especially when faced with Han shock cavalry and chariots as the Xiongnu are easily dispersed. He emphasized that the Xiongnu were incapable of countering the superior equipment and weaponry. He also noted that in contrast the Han armies were better capable to fight in disciplined formations. According to Chao, the Xiongnu were also defenseless against coordinated onslaughts of arrows—especially long-ranged and in unison—due to their inferior leather armour and wooden shields. When dismounted in close combat, he believed that the Xiongnu, lacking the ability as infantry, would be decimated by Han soldiers.
 During Emperor Jing's reign, the Han court initiated breeding programs for military horses and established 36 large government pastures in the border regions, extending from Liaodong to Beidi. In preparation for the military use of the horses, the best breeds were selected to partake military training. The Xiongnu frequently raided the Han government pastures, because the military horses were of great strategic importance for the Han military against them. By the time of Emperor Wu's reign, the horses amounted to well over 450,000.
 At the start of Emperor Wu's reign, the Han empire had a standing army comprising 400,000 troops, which included 80,000 to 100,000 cavalrymen, essential to the future campaigns against the Xiongnu. However, by 124 BC, that number had grown to a total of 600,000 to 700,000 troops, including 200,000 to 250,000 cavalrymen. In order to sustain the military expeditions against the Xiongnu and its resulting conquests, Emperor Wu and his economic advisors undertook many economic and financial reforms, which proved to be highly successful.
 In 14 AD, Yan Yu presented the difficulties of conducting extended military campaigns against the Xiongnu. For a 300-day campaign, each Han soldier needed 360 liters of dried grain. These heavy supplies had to be carried by oxen, but experience showed that an ox could only survive for about 100 days in the desert. Once in the territory of the Xiongnu, the harsh weather would also prove to be very inhospitable for the Han soldiers, who could not carry enough fuel for the winter. For these reasons, according to Yan Yu, military expeditions seldom lasted longer than 100 days.
 For their western campaigns against the Xiongnu, the Han armies exacted their food supplies from the Western Regions. This placed a heavy burden to the western states, thus the Han court decided to initiate agricultural garrisons in Bugur and Kurla. During Emperor Zhao's reign (r. 87–74 BC), the agricultural garrison in Bugur was expanded to accommodate the heavy Han military presence which was the natural result of the empire's westward expansion. During Emperor Xuan's reign (r. 74–49 BC), the farming soldiers in Kurla were increased to 1500 under Protector-General Zheng Ji's administration in order to support the military expeditions against the Xiongnu in Turfan. Immediately after the Han conquest of Turfan, Zheng established an agricultural garrison in Turfan. Even though, the Xiongnu unsuccessfully tried to prevent the Han from making Turfan into a major economic base by military force and threats.
 In 162 BC, the Xiongnu troops of Laoshang Chanyu had invaded and driven the Yuezhi from their homeland; the Chanyu had the Yuezhi monarch executed and his skull fashioned into a drinking cup. Thus the Han court decided it was favourable to send an envoy to the Yuezhi to secure a military alliance. In 138 BC, the diplomat Zhang Qian left with an envoy and headed towards the Yuezhi encampments. However, the envoy was captured by the Xiongnu and held hostage. A decade went by, until Zhang Qian and some of his convoy escaped. They travelled to the territories of Ferghana (Dayuan 大宛), Soghdiana (Kangju 康居), and Bactria (Daxia 大夏), ultimately finding the Yuezhi forces north of the Amu River. Despite their efforts, the envoy could not secure a military alliance. As the Yuezhi had settled in those new lands for quite some time, they had almost no desire to wage a war against the Xiongnu. In 126 BC, Zhang Qian headed to the Hexi Corridor in order to return to his nation. While traveling through the area, he was captured by the Xiongnu, only to escape a year later and return to China in 125 BC.
 The Xiongnu attempted to negotiate peace several times, but every time the Han court would accept nothing less than tributary submission of the Xiongnu. Tributary relations with the Han comprised out of several things. Firstly, the Chanyu or his representative was required to come pay homage to the Han court. Secondly the heir apparent or a prince needed to be delivered to the Han court as hostage. Thirdly, the Chanyu had to present tribute to the Han emperor and in return will receive imperial gifts. Accepting the tributary system meant that the Xiongnu were lowered to the status of outer vassal, while the marriage alliance meant that the two nations were regarded as equal states. In 119 BC, Yizhixie Chanyu (126–114) sent an envoy, hoping to achieve peaceful relations with the Han. However, the peace negotiations collapsed, since the Han court disregarded his terms and gave him the option to become an outer vassal instead, which infuriated Yizhixie Chanyu. In 107 BC, Wuwei Chanyu (114–105) also attempted to negotiate peaceful relations and even halted the border raids. In response, the Han disregarded his terms and demanded that the Chanyu sent his heir apparent as a hostage to Chang'an, which once again led to the breakdown of the peace negotiations.
 In 53 BC, Huhanye Chanyu decided to submit to the Han court. He sent his son Zhulouqutang (朱鏤蕖堂), the Tuqi King of the Right, as hostage to the Han court in 53 BC. In 52 BC, he formally requested through the officials at the Wuyuan commandery to have an audience with the Han court to pay homage. Thus, the next year (51 BC), he arrived at court and personally paid homage to Emperor Xuan during the Chinese New Year. In 49 BC, he traveled to the Han court for a second time to pay homage to the emperor. In 53 BC, Zhizhi Chanyu also sent his son as hostage to the Han court. In 51 and 50 BC, he sent two envoys respectively to Han to present tribute, but failed to personally come to the Han court to pay homage. Therefore, he was rejected by the Han court, leading to the execution of a Han envoy in 45 BC. In 33 BC, Huhanye Chanyu came to the Han court to pay homage again. During his visit, he asked to become an imperial son-in-law. Instead of granting him this request, Emperor Yuan decided to give him a court lady-in-waiting. Thus, the Han court allowed Huhanye Chanyu to marry Lady Wang Zhaojun. Yituzhiyashi (伊屠智牙師), the son of Huhanye and Wang Zhaojun, became a vocal partisan for the Han empire within the Xiongnu realm. Although peaceful relations were momentarily achieved, it fully collapsed when the Han official Wang Mang came to power.
 When Bi, the Southern Chanyu, decided submit to the Han in 50 AD, he sent a princely son as hostage to the Han court and prostrated to the Han envoy as he received the imperial edict from them. During the Eastern Han period, the tributary system had made some significant changes, which placed the Southern Xiongnu more tightly under regulation and supervision of the Han. The Chanyu was required to send tribute and a princely hostage annually, while an imperial messenger would be dispatched to escort the previous princely hostage back. The Southern Xiongnu were resettled inside the empire at the northern commanderies and were overseen by a Han prefect, who acted as an arbiter in their legal cases and monitored their movements. Attempts by Punu, the Northern Chanyu, to establish peaceful relations with the Han empire always failed, because the Northern Xiongnu were unwilling to come under Han's tributary system and the Han court had no interest to treat them along the same lines as the Southern Xiongnu instead of dividing them.
 In 169 BC, the Han minister Chao Cuo presented to Emperor Wen a memorandum on frontier defence and the importance of agriculture. Chao characterized the Xiongnu as people whose livelihood did not depend on permanent settlement and were always migrating. As such, he wrote, the Xiongnu could observe the Han frontier and attack when there were too few troops stationed in a certain region. He noted that if troops are mobilized in support, then few troops will be insufficient to defeat the Xiongnu, while many troops will arrive too late as the Xiongnu will have retreated by then. He also noted that keeping the Xiongnu mobilized will be at a great expense, while they will just raid another time after dispersing them. To negate these difficulties, Chao Cuo elaborated a proposal, which in essence suggested that military-agricultural settlements with permanent residents should be established to secure the frontier and that surrendered tribes should serve along the frontier against the Xiongnu.
 When Emperor Wu made the decision to conquer the Hexi Corridor, he had the intention to separate the Xiongnu from the Western Regions and from the Qiang people. In 88 BC, the Xianling tribe of the Qiang people sent an envoy to the Xiongnu, proposing a joint-attack against the Han in the region as they were discontented that they had lost the fertile lands at Jiuquan and Zhangye. It had often been the meeting place between the Xiongnu and the Qiang before the Han empire had conquered and annexed the Hexi Corridor. In 6 BC, Wang Shun (王舜) and Liu Xin noted that the frontier commanderies of Jiuquan, Zhangye, and Dunhuang were established by Emperor Wu to separate the then-powerful Chuoqiang tribe of the Qiang people from the Xiongnu. The Chuoqiang tribe and its king, however, eventually submitted to the Han empire and took part in the campaigns against the Xiongnu.
 In 119 BC, when the Xiongnu suffered a catastrophic defeat by the Han armies, the Chanyu moved his court (located in present-day Inner Mongolia) to another location north. This had the desired result that the Xiongnu were separated from the Wuhuan people, which also prevented the Xiongnu from exacting many resources from the Wuhuan. The Han court placed the Wuhuan in tributary protection and resettled them in five northeastern commanderies, namely Shanggu, Yuyang, Youbeiping (present-day Hebei), Liaoxi, and Liaodong (present-day Liaoning). A new office, the Colonel-Protector of the Wuhuan, was established in Shanggu in order to prevent contact between the Wuhuan with the Xiongnu and to use them to monitor the Xiongnu activities. Nevertheless, the effective Han control over the Wuhuan was lacking through much of the Western Han period, since the Xiongnu had considerable military and political influence over the Wuhuan while relations between the Wuhuan and Han often remained strained at best. This can be exemplified by a situation in 78 BC, when the Xiongnu led a punitive campaign against the Wuhuan, resulting in General Fan Mingyou (范明友) leading a Han army to impede further incursions. When they learned that the Xiongnu had left by the time the army arrived, the Han court ordered Fan to attack the Wuhuan instead, killing 6000 Wuhuan men and three chieftains, since the Wuhuan had recently raided Han territory. Only in 49 AD, when 922 Wuhuan chieftains submitted during Emperor Guangwu's reign, did many of the Wuhuan tribes come under tributary system of the Han empire. The Han court provided for the Wuhuan and in return the Wuhuan tribes guarded the Han frontier against the Xiongnu and other nomadic peoples.
 When the Hunye King surrendered to the Han in 121 BC, the Han court resettled all the 40,000 Xiongnu people from the Hexi Corridor into the northern frontier regions. The Hexi Corridor proved to be an invaluable region, since it gave direct access and became the base of military operations into the Western Regions Possession of the Western Regions was economically critical to the Xiongnu, since they exacted many of their necessary resources from the western states. The diplomat Zhang Qian suggested to the emperor to establish diplomatic relations with the western states. He proposed to try convince the Wusun in reoccupying their former territory in the Hexi Corridor and to form an alliance with them against the Xiongnu. In 115 BC, Zhang Qian and his men were sent towards the Western Regions, but they did not succeed in convincing the Wusun to relocate. They were, however, successful in establishing contact with the many states, such as Wusun, Dayuan (Ferghana), Kangju (Soghdiana), Daxia (Bactria), and Yutian (Khotan). Although the Han empire tried to diplomatically sway the western states over the years, it met with little success due to the Xiongnu's influence over the Western Regions at the time. Therefore, from 108 BC onwards, the Han resorted to conquest in order to bring the western states to submission.
 Since Loulan (Cherchen) was the closest western state to Han, it was key for the Han empire's expansion into Central Asia. Turfan (Jushi), on the other hand, was the Xiongnu's entrance into the Western Regions. By conquering Loulan and Turfan, the Han empire would gain two critical locations in the Western Regions, achieving direct access to the Wusun in the Ili River valley and Dayuan (Ferghana) between Syr and Amu Darya. This happened in 108 BC, when General Zhao Ponu conquered these two states. The farthest-reaching invasion was Li Guangli's campaign against Ferghana. If the Han armies succeeded in conquering Ferghana, the Han empire would demonstrate certain military might to the western states and consolidate its control, while gaining many of the famed Ferghana horses. The Xiongnu were aware of the situation and attempted to stop the invasion, but they were defeated by Li Guangli's forces. After a campaign that lasted four years, Li Guangli conquered Ferghana in 101 BC.
 The control over Turfan, however, often fluctuated due to its proximity to the Xiongnu. In 90 BC, General Cheng Wan (成娩) led the troops of six western states against Turfan to prevent it from allying the Xiongnu. The fact that the forces used comprised solely from the troops of the western states was, as Lewis (2007) remarked, a clear indication of the political influence that the Han empire had over the region. Cheng was a former Xiongnu king himself, but he had submitted to the Han and was ennobled as Marquis of Kailing (開陵侯). As a result of the expedition, the Han court received the formal submission of Turfan later in the year (90 BC). This victory was significant in the sense that Turfan's location was the closest to the Xiongnu of all the western states, thereby they lost their access into the Western Regions with this Han conquest.
 In 67 BC, the Han empire gained absolute control over the Turfan Depression after inflicting a significant defeat to the Xiongnu. During the former Xiongnu rule of the Western Regions, the area was under the jurisdiction of the Rizhu King (日逐王) with the office "Commandant in
Charge of Slaves". However, in 60 BC, the Rizhu King surrendered to Protector General Zheng Ji. Afterwards (60 BC), the Han imperial court established the Protectorate of the Western Regions. The Han empire, now in absolute control of the Western Regions, placed it under the jurisdiction of its Protector General. As its dominance of the area was established, the Han were effectively controlling the trade and shaping the early history of what would be known as the Silk Road.
 In 25 AD, Liu Xiu was established as Emperor Guangwu, restoring the Han throne after a usurpation by the Han official Wang Mang, thus initiating the Eastern Han period. During his reign, the Han empire began to abandon its offensive strategy against the Xiongnu, which allowed the latter to frequently raid the northern frontier. It resulted in large migrations southwards, which led to the depopulation of the frontier regions. During the Eastern Han period, various nomadic peoples were resettled in these frontier regions, serving the Han empire as cavalry against the Xiongnu. With his primary focus still towards the interior of the empire, Emperor Guangwu declined several requests from the western states to re-establish the office of Protector-General of the Western Regions. Early in Emperor Guangwu's reign, King Kang of Yarkand united neighbouring kingdoms to resist the Xiongnu. At the same time, he protected the Han officials and people of the former Protector-General, who were still left behind after Wang Mang's reign. In 61 AD, Yarkand was conquered by Khotan and the western states fell in conflict with each other. Taking this opportunity, the Northern Xiongnu recovered their control over the Western Regions, which threatened the security of the Hexi Corridor. In 73 AD, General Dou Gu was sent on a punitive expedition to the Xiongnu and inflicted them a considerable defeat. Immediately, the fertile lands of Hami (Yiwu) was reoccupied and an agricultural garrison established. The next year (74 AD), he expelled the Xiongnu from Turfan and reoccupied the state. The recovery of Hami and Turfan facilitated the re-establishment of the Protector-General, since these important locations were key points to control the Western Regions.