In the Battle of Julu, the Chu army achieved a great victory. After his defeat, Zhang Han knew that the Qin state would not forgive him, so he simply surrendered to Xiang Yu along with his 200,000 Qin troops. Xiang Yu appointed Zhang Han as the King of Yong but remained wary of him, while the 200,000 Qin soldiers were placed under the command of Sima Xin, a close friend of the late Xiang Liang.
When the news of Zhang Han's surrender reached the Qin palace, Prime Minister Zhao Gao sensed that the Qin dynasty's fate was sealed, yet he still harbored dreams of becoming emperor. As the allied forces were about to storm Xianyang City, Qin Ershi, Hu Hai, began to doubt himself, prompting Zhao Gao to launch a coup first. He joined forces with his brother and son-in-law, leading the palace guards into the palace under the pretext of catching bandits, indiscriminately slaughtering innocent palace attendants, and ultimately forcing Qin Ershi to hang himself. Zhao Gao, fully believing that possessing the imperial seal would make him emperor, was shocked to find that the civil and military officials utterly rejected him, leaving him at a loss. With no other choice, Zhao Gao handed the seal to Ziying, who, unwilling to be manipulated by Zhao Gao, devised a plan to kill him.
In October 206 BCE, Liu Bang led his army to be the first to occupy Xianyang. The King of Qin, Ziying, waited by the roadside with a white horse and a simple carriage; upon seeing Liu Bang, he presented the imperial seal with both hands as a gesture of sincere surrender. Liu Bang, being kind-hearted, only ordered his soldiers to keep a close watch on Ziying and did not kill him. Once inside the Qin palace, Liu Bang was immediately captivated by the lavish furnishings and beautiful palace women, but thanks to the advice of his advisors, he did not linger there excessively.
Liu Bang led his army away from Xianyang city and camped at Bashang, then gathered the local gentry and commoners for a meeting. During the assembly, Liu Bang reassured the frightened people, declaring that the brutal Qin Dynasty had fallen and no one would ever suffer under its harsh laws again. He asked the people to rest assured that the armies of the feudal states were different from the Qin forces, and from now on, officials at all levels should continue their work as usual. He also put forward three requirements: murder must be avenged with death; causing harm to others must be punished; theft and other crimes should be penalized according to severity. Upon hearing this, the people were overjoyed and brought their own meat and wine to offer to Liu Bang's army, but Liu Bang declined, thanking the people for their goodwill and repeatedly assuring them that he would not harm them in the slightest. Having endured the hellish rule of the Qin Dynasty, the people developed deep affection for this merciful leader, and everyone vied to ask Liu Bang to become emperor.
When Xiang Yu heard that Liu Bang had entered Xianyang, he flew into a furious rage and rushed toward the city, but he worried that the 200,000 surrendered Qin troops might rebel when he wasn't paying attention, so he mixed some low-ranking Chu officers and soldiers among the Qin troops to gather intelligence. Although Zhang Han had surrendered to Xiang Yu and received rewards, the Qin soldiers got no compensation and instead suffered humiliation and neglect from the Chu army. Sima Xin heard about this and knew the fault lay with the Qin troops, but he was not good at arguing and could only silently comfort them. The Qin soldiers grew deeply dissatisfied with Xiang Yu, becoming restless and resentful, with many filled with anger and hatred. The Chu soldiers planted among them immediately reported this to Xiang Yu, who decided to go all the way and eliminate the entire Qin army. 200,000 was no small number, requiring huge daily food supplies, and with their disloyalty, Xiang Yu saw them as a major threat. He first lured Sima Xin away, then Ying Bu launched a night attack on the Qin troops. The soldiers panicked, trampling and pushing each other, causing countless deaths. The survivors, along with the dead, were all buried by the Chu army in a massive pit. This incident had a severe impact on Xiang Yu and the Chu army, and combined with his later rampage of burning and looting in Xianyang, the people held no goodwill toward him, sealing his eventual defeat. Liu Bang, by contrast, adopted a policy of pacifying the people after entering Xianyang, winning their support. Xiang Yu, impulsive and reckless, was unfit to bear the heavy responsibility of leading the nation, and it was already clear who would rule the realm.