In between eras of multiple kingdoms and warlordism, Chinese dynasties have ruled parts or all of China; in some eras, including the present, control has stretched as far as Xinjiang and/or Tibet. This practice began with the Qin dynasty: in 221 BC, Qin Shi Huang united the various warring kingdoms and created the first Chinese empire. Successive dynasties in Chinese history developed bureaucratic systems that enabled the Emperor of China to directly control vast territories. China's last dynasty was Qing, which was replaced by the Republic of China in 1912, and in the mainland by the People's Republic of China in 1949.