End of the Han dynasty
The end of the Han dynasty refers to the period of Chinese history from 189 to 220 AD, which roughly coincides with the tumultuous reign of the Han dynasty's last ruler, Emperor Xian. During this period, the country was thrown into turmoil by the Yellow Turban Rebellion (184–205). Meanwhile, the Han Empire's institutions were destroyed by the warlord Dong Zhuo, and fractured into regional regimes ruled by various warlords, some of whom were nobles and officials of the Han imperial court. Eventually, one of those warlords, Cao Cao, was able to gradually reunify the empire, ostensibly under Emperor Xian's rule, but the empire was actually controlled by Cao Cao himself. Cao Cao's efforts to completely reunite the Han empire were rebuffed at the Battle of Red Cliffs in 208 / 209, when his armies were defeated by the allied forces of Sun Quan and Liu Bei. The Han dynasty formally ended in 220 when Cao Cao's son and heir, Cao Pi, pressured Emperor Xian into abdicating in his favour. Cao Pi became the emperor of a new state, Cao Wei. A year later, in response to Cao Pi's usurpation of the Han throne, Liu Bei declared himself emperor of Shu Han; and in 229, Sun Quan followed suit, declaring himself emperor of Eastern Wu. The period from Emperor Xian's abdication in 220 to the partial reunification of China under the Jin dynasty in 265 was known as the Three Kingdoms era in Chinese history.
History of the Han dynasty
When Cao Cao moved Emperor Xian to Xuchang in 196 CE, he took the title of Excellency of Works as Dong Zhuo had before him. In 208 CE, Cao abolished the three most senior offices, the Three Excellencies, and instead recreated two offices, the Imperial Counselor and Chancellor; he occupied the latter post. Cao was enfeoffed as the Duke of Wei in 213 CE, had Emperor Xian divorce Empress Fu Shou in 214 CE, and then had him marry his daughter as Empress Cao Jie in 215 CE. Finally, Cao took the title King of Wei in 216 CE, violating the rule that only Liu family members could become kings, yet he never deposed Emperor Xian. After Cao Cao died in 220 CE, his son Cao Pi (186–226 CE) inherited the title King of Wei and gained the uneasy allegiance of Sun Quan (while Liu Bei at this point had taken over Liu Zhang's territory of Yi Province). With debates over prognostication and signs from heaven showing the Han had lost the Mandate of Heaven, Emperor Xian agreed that the Han dynasty had reached its end and abdicated to Cao Pi on December 11, 220 CE, thus creating the state of Cao Wei, soon to oppose Shu Han in 221 CE and Eastern Wu in 229 CE.