<P> In 202 BC, the former peasant Liu Bang emerged victorious from the Chu--Han Contention that followed the rebellion that toppled the Qin dynasty, and proclaimed himself Emperor of the Han dynasty, becoming known as Emperor Gaozu of Han (r . 202--195 BC) to posterity . Unable to address the problem of the resurgent Xiongnu in the Ordos region through military means, Emperor Gaozu was forced to appease the Xiongnu . In exchange for peace, the Han offered tributes along with princesses to marry off to the Xiongnu chiefs . These diplomatic marriages would become known as heqin, and the terms specified that the Great Wall (determined to be either the Warring States period Qin state wall or a short stretch of wall south of Yanmen Pass) was to serve as the line across which neither party would venture . In 162 BC, Gaozu's son Emperor Wen clarified the agreement, suggesting the Xiongnu chanyu held authority north of the Wall and the Han emperor held authority south of it . Sima Qian, the author of the Records of the Grand Historian, describes the result of this agreement as one of peace and friendship: "from the chanyu downwards, all the Xiongnu grew friendly with the Han, coming and going along the Long Wall". However, Chinese records show that the Xiongnu often did not respect the agreement, as the Xiongnu cavalry numbering up to 100,000 made several intrusions into Han territory despite the intermarriage . </P> <P> To Chinese minds, the heqin policy was humiliating and ran contrary to the Sinocentric world order like "a person hanging upside down", as the statesman Jia Yi (d . 169 BC) puts it . These sentiments manifested themselves in the Han court in the form of the pro-war faction, who advocated the reversal of Han's policy of appeasement . By the reign of Emperor Wu (r . 141--87 BC), the Han felt comfortable enough to go to war with the Xiongnu . After a botched attempt at luring the Xiongnu army into an ambush at the Battle of Mayi in 133 BC, the era of heqin - style appeasement was broken and the Han--Xiongnu War went into full swing . </P> <P> As the Han--Xiongnu War progressed in favour of the Han, the Wall became maintained and extended beyond Qin lines . In 127 BC, General Wei Qing invaded the much - contested Ordos region as far as the Qin fortifications set up by Meng Tian . In this way, Wei Qing reconquered the irrigable lands north of the Ordos and restored the spur of defences protecting that territory from the steppe . In addition to rebuilding the walls, archeologists believe that the Han also erected thousands of kilometres of walls from Hebei to Inner Mongolia during Emperor Wu's reign . The fortifications here include embankments, beacon stations, and forts, all constructed with a combination of tamped - earth cores and stone frontages . From the Ordos Loop, the sporadic and non-continuous Han Great Wall followed the northern edge of the Hexi Corridor through the cities of Wuwei, Zhangye, and Jiuquan, leading into the Juyan Lake Basin, and terminating in two places: the Yumen Pass in the north, or the Yang Pass to the south, both in the vicinity of Dunhuang . Yumen Pass was the most westerly of all Han Chinese fortifications--further west than the western terminus of the Ming Great Wall at Jiayu Pass, about 460 kilometres (290 mi) to the east . The garrisons of the watchtowers on the wall were supported by civilian farming and by military agricultural colonies known as tuntian . Behind this line of fortifications, the Han government was able to maintain its settlements and its communications to the Western Regions in central Asia, generally secure from attacks from the north . </P> <P> The campaigns against the Xiongnu and other nomadic peoples of the west exhausted the imperial treasury, and the expansionist policies were reverted in favour of peace under Emperor Wu's successors . The peace was largely respected even when the Han throne was usurped by the minister Wang Mang in 9 AD, beginning a brief 15 - year interregnum known as the Xin dynasty (9--23). Despite high tensions between the Xin and the Xiongnu resulting in the deployment of 300,000 men on the Great Wall, no major fighting broke out beyond minor raids . Instead, popular discontent led to banditry and, ultimately, full - scale rebellion . The civil war ended with the Liu clan on the throne again, beginning the Eastern Han dynasty (25--220). </P>

Who ordered to build the great wall of china