After the death of the First Emperor, the powerful eunuch Zhao Gao 趙高 and the Counsellor-in-chief, Li Si 李斯, machinated the accession to the throne of Prince Huhai 胡亥. They forged an edict of the late emperor to the Heir Apparent, Prince Fusu 扶蘇, to kill himself. The Prince obeyed, and Huhai became the Second Emperor of Qin 秦二世皇 (r. 209-207). Huhai at first obeyed all the plans of the powerful eunuch, but when the latter eliminated Li Si and widespread peasant rebellions broke out, Zhao Gao killed Huhai.
The eunuch therupon enthroned a Prince Ziying. The latter was either a nephew or a cousin of the Second Emperor or a younger brother of the First Emperor. Ziying had formerly vehemently criticized the Second Emperor for his blind trust into Zhao Gao and his brutal murdering of competent officials, like the relatives of general Meng Tian 蒙恬 (d. 210 BCE). On his accession to the throne in 207, Ziying renounced the title of emperor and expressed his contentedness with the title of King of Qin. Ziying knew some eunuchs he could trust, like Han Tan 韓談, and managed to have Zhao Gao killed.
He was only king for 46 days at the time when the army of the rebel leader Liu Bang 劉邦 (d. 195 BCE), the eventual founder of the Han dynasty 漢 (206 BCE-220 CE), reached the capital Xianyang 咸陽 (modern Xianyang, Shaanxi). Known that the dynasty's fate came to a close, Ziying rushed out the city to welcome Liu Bang and presented him the state seals and submitted to the rebel army. Liu Bang accepted Ziying's surrender.