Hanzhong (; abbreviation: Han) is a prefecture-level city in the southwest of Shaanxi province, China, bordering the provinces of Sichuan to the south and Gansu to the west. The founder of the Han dynasty, Liu Bang, was once enfeoffed as the king of the Hanzhong region after overthrowing the Qin dynasty. During the Chu-Han contention, Liu Bang shortened his title to the King of Han (), and later used it as the name of his imperial dynasty. In this way, Hanzhong was responsible for the naming of the Han dynasty, which was later hailed as the first golden age in imperial Chinese history and lends its name to the principal ethnic group in China. Hanzhong is located at the modern headwater of the Han River, the largest tributary of the Yangtze River. Hanzhong city covers and is centered around the Hantai District. The prefecture-level city consists of two urban district and nine rural counties. As of the 2020 census, its population was 3,211,462, of whom 1,084,448 lived in the built-up (or metro) area made of Hantai and Nanzheng districts. History Pre-Qin dynasty (before 220 BC) There are few references to Hanzhong before the Qin dynasty's unification of China in 221 BC. The Book of Documents refers to an area called Liangzhou (), while Sima Qian's book Records of the Grand Historian speaks of a "Bao state" (, where the ancient beauty Bao Si came from), both of which are believed to refer to the area now called Hanzhong. From 900 BC, the area has been called Nanzheng (). The ancient geographical treatise entitled Shui Jing Zhu records that Duke Huan of Zheng, a vassal lord from the Western Zhou dynasty, was slain in a battle with the nomadic Quanrong people, and some of the Zheng citizens fled the capital to establish a new settlement to the south, giving rise to the area's name. However, the veracity of this story is controversial. Qin and Han dynasties (220 BC - 200 AD) In the Qin dynasty the area was governed as the Hanzhong Commandery, whose seat was in current day Nanzheng County, south of the Hanzhong urban area. In 207 BC, the Qin dynasty collapsed. Liu Bang, who would later become the founding emperor of the Han dynasty, was made lord of Hanzhong. He spent several years there before raising an army to challenge his archrival, Xiang Yu, during the Chu–Han Contention.