The Sui Dynasty unified China in 589 under a Chinese emperor for the first time since the fall of the Han Dynasty. Yang Jian, the founding emperor, posthumously known as Sui Wendi, began his career as a high official under the Northern Zhou and was actually the father-in-law of the last Northern Zhou emperor. Yang had worked dutifully for the Yuwen imperial house, earning a Xianbei surname as a mark of favor, in addition to marrying his daughter to the emperor. Yang seized power soon after a six-year-old child succeeded to the throne, and he exterminated most of the Yuwen clan. He established the Sui dynasty on 4 March 581. Yang was remarkably successful in quickly consolidating his power and shifting over to the conquest of southern China. By 589, Sui navies and armies had defeated every polity in the Chinese ecumene.
Yang Jian himself, though a member of the northern Chinese aristocracy, was fully conversant with Xianbei culture. He was also a devout Buddhist, who hoped that his religion would help unite his empire, while at the same time promoting Confucianism to aid in governing society. Even Daoism was not wholly neglected. Yang reorganized the government institutions he had inherited in order to centralize power. His interest in controlling the reins of power extended even to the Buddhism he supported; he was careful to regulate the Buddhist clergy. He and his son, Yang Guang, posthumously known as Sui Yangdi, understood the need to rule by means other than force of arms alone. They also knew that they had to gain firm control over the soldiers and armies if they were to stay in power.