Context: https://en.wikipedia.org/wiki/Emperor_Gaozu_of_Han
Emperor Gaozu of Han (256 or 247 – 1 June 195 BC), personal name Liu Bang, was the founder and first emperor of the Han dynasty.
Liu Bang was among the few dynastic founders to have been born in a peasant family. He initially entered the Qin dynasty bureaucracy as a minor law enforcement officer in his hometown in Pei County. During the political chaos following the death of Qin Shi Huang, Liu Bang renounced his civil service position and became a rebel leader, taking up arms against the Qin dynasty. He outmaneuvered rival rebel leader Xiang Yu to invade the Qin heartland and forced the surrender of the Qin ruler Ziying in 206 BC.
After the fall of the Qin dynasty, Xiang Yu divided the former Qin Empire into the Eighteen Kingdoms, with Liu Bang forced to accept control of the poor and remote region of Bashu, assuming the title “King of Han”. Within the year, Liu Bang broke out with his army and conquered the Three Qins, starting the Chu–Han Contention, a civil war among various forces seeking to inherit the Qin dynasty’s former territory.
In 202 BC, Liu Bang emerged victorious following the Battle of Gaixia, took control over much of the territory previously ruled by Qin, and established the Han dynasty with himself as the emperor. During his reign, Liu Bang reduced taxes and corvée labour, promoted Confucianism, and suppressed revolts by the rulers of vassal states not from his own clan. He also initiated the policy of heqin, a system of arranged marriages, to maintain peace between the Han Empire and the Xiongnu following the Han defeat at the Battle of Baideng in 200 BC. He died in 195 BC and was succeeded by his son Liu Ying.
Liu was responsible for escorting a group of penal labourers to the construction site of Qin Shi Huang’s mausoleum at Mount Li. During the journey, some prisoners escaped; under Qin law, allowing prisoners to escape was punishable by death. Rather than face punishment, Liu freed the remaining prisoners, some of whom willingly acknowledged him as their leader and joined him on the run from the law. At around the same time, Qin Shi Huang, upon hearing rumours of qi of the Son of Heaven appearing in the southeast, embarked on his fifth and final tour of the country. As outlaws, Liu Bang and his men took over an abandoned stronghold on Mount Mangdang.
According to the legend known as the “Uprising of the Slaying of the White Serpent”, Liu’s ascension to rulership was prophesied after he became an outlaw. In the legend, his followers encountered a gigantic white serpent which killed some of them with its poisonous breath. That night, while he was drunk, Liu drew his sword and slew the serpent. The next morning, the outlaws encountered a crying old woman along the road. When they asked her why she was crying, she replied, “My child, the White Emperor’s son, has been slain by the son of the Red Emperor.” After that, she mysteriously disappeared. As this legend spread, Liu’s reputation grew among his followers, who became convinced of his destiny.

