The emperors of the Han dynasty were the supreme heads of government during the second imperial dynasty of China; the Han dynasty (202 BC – 220 AD) followed the Qin dynasty (221–206 BC) and preceded the Three Kingdoms (220–265 AD). The era is conventionally divided between the Western Han (202 BC – 9 AD) and Eastern Han (25–220 AD) periods. The Han dynasty was founded by the peasant rebel leader (Liu Bang), known posthumously as Emperor Gao (r. 202 –195 BC) or Gaodi. The longest reigning emperor of the dynasty was Emperor Wu (r. 141–87 BC), or Wudi, who reigned for 54 years. The dynasty was briefly interrupted by the Xin dynasty of the former regent Wang Mang, but he was killed during a rebellion on 6 October 23 AD. The Han dynasty was reestablished by Liu Xiu, known posthumously as Emperor Guangwu (r. 25–57 AD) or Guangwu Di, who claimed the throne on 5 August 25 AD. The last Han emperor, Emperor Xian (r. 189–220 AD), was a puppet monarch of Chancellor Cao Cao (155–220 AD), who dominated the court and was made King of Wei. On 11 December 220, Cao's son Pi usurped the throne as Emperor Wen of Wei (r. 220–226 AD) and ended the Han dynasty. The emperor was the supreme head of government. He appointed all of the highest-ranking officials in central, provincial, commandery, and county administrations. He also functioned as a lawgiver, the highest court judge, commander-in-chief of the armed forces, and high priest of the state-sponsored religious cults. Naming conventions Emperor In ancient China, the rulers of the Shang (c. 1600 – c. 1050 BC) and Zhou (c. 1050 – 256 BC) dynasties were referred to as kings (王 wang). By the time of the Zhou dynasty, they were also referred to as Sons of Heaven (天子 Tianzi). By 221 BC, the King of Qin, Ying Zheng, conquered and united all the Warring States of ancient China. To elevate himself above the Shang and Zhou kings of old, he accepted the new title of emperor (皇帝 huangdi) and is known to posterity as the First Emperor of Qin (Qin Shi Huang). The new title of emperor was created by combining the titles for the Three Sovereigns (Sanhuang) and Five Emperors (Wudi) from Chinese mythology. This title was used by each successive ruler of China until the fall of the Qing dynasty in 1911.