Li Yuan under the Sui
Li Yuan belonged to the military aristocracy of north-west China, whose families had long intermarried with the Xianbei elite of the northern dynasties. His father died in 572, and he inherited the title of Duke of Tang as a child. His mother was a sister of Empress Dugu, the wife of Emperor Wen, founder of the Sui, so he was the nephew of the empress and a cousin of the future Emperor Yang.
He held a series of provincial and military posts under the Sui. By the time the dynasty began to break apart under Emperor Yang, whose failed wars in Korea and heavy demands for labour had provoked rebellions across the empire, Li Yuan was in command at Taiyuan in Shanxi, a key position on the northern frontier facing the Eastern Turks.
The Rebellion of 617
In 617, encouraged by his son Li Shimin and other close advisers, Li Yuan rose in revolt. He came to terms with the Eastern Turks, who supplied horses and troops, marched south and captured the Sui capital, Chang'an, at the end of the year. There he placed Emperor Yang's young grandson Yang You on the throne as Emperor Gong, with himself as regent, while Emperor Yang remained in the south at Jiangdu.
In the spring of 618 Emperor Yang was murdered by his own officers at Jiangdu. When the news reached Chang'an, Li Yuan had the boy emperor abdicate in his favour and proclaimed the Tang dynasty.
Building the New State
The new emperor kept much of the Sui system of government, and employed many former Sui officials alongside his own followers, which gave the young dynasty both experience and continuity. He retained the equal-field system of land allocation and the tax system based on it, and tried to lighten the burden of taxes and labour service that had helped to bring the Sui down.
In 621 his government introduced a new bronze coin, the Kaiyuan tongbao, which remained the standard coin of China for centuries. In 624 it issued a law code, based closely on that of the Sui. Revised under his successors, the Tang code became the model for later Chinese dynasties and for legal systems in Korea, Japan and Vietnam.
The Wars of Reunification
When the Tang was proclaimed, much of China was held by rival rebel regimes. The most important campaigns were led by Li Shimin, who defeated the rulers of the north-west in 618, Liu Wuzhou in the north in 620, and in 621 both Wang Shichong at Luoyang and Dou Jiande, who had marched to his aid. The crown prince, Li Jiancheng, also commanded successfully in the north-east. By 624 the last major rivals had been subdued. The Eastern Turks, however, remained a serious threat, and in 624 and 626 their armies came close to Chang'an.