linguistic:voice_change, quality:correction
Dahe Confederation

Sometime during the Sui dynasty, the military organization of the Khitans became more advanced. According to the Book of Sui, "In the case of a military operation, the chieftains discussed it together. In mobilizing troops, tallies needed to be matched". In the early 7th century, the Dahe clan unified the Khitan tribes in a federation that was able to raise 34,000 troops. The tribal composition of the Dahe Confederation is listed as Daji, Hebian, Duhuo, Fenwen, Tubian, Ruixi, Zhuijin, and Fu. The Hedahe were the leading tribe of the Confederation, from which its name is taken from. Other tribes mentioned are: Danjieli, Yishihuo, Shihuo, Nawei, Pinmo, Nahuiji, Jijie, and Xiwa. The component tribes were largely autonomous and the Dahe were only responsible for foreign affairs. After the Dahe united the Khitans, the system of rotating leadership was replaced by "Shixuan", electing a leader based on their talent and ability from the Dahe lineage. The other clans had the right to vote but not to be elected. Brothers, cousins, and nephews often succeeded rather than the son of the previous leader. No internal conflicts among the Khitan tribes are recorded after the unification of the Dahe.

In the early history of the Khitan, there was a man riding a white horse and a woman riding a cart drawn by a gray ox. They met on the Liao River and then became husband and wife. They had eight sons who were called by the previous histories the persons who took turns to be the supreme leader. This event was known from Zhao Zhizhong who had been an official historian of the Khitan, so that it must be true... (Zhizhong) was asked which dynasty the Central Plain was in, when the leadership rotated among the eight (Khitan) men. Zhizhong could not answer, but he said that it probably was in the Qin/Han period. (I) am afraid that it was not true.

In 628, the Dahe Confederation led by Mohui submitted to the Tang. In 648, they submitted to the Tang again under the leadership of Kuge. Kuge was appointed the Governor-general of Songmo and several prefectures were set up for Khitan tribes: Qiaoluo for the Daji, Tanhan for the Hebian, Wufeng for the Duhuo, Yuling for the Fenwen, Rilian for the Tubian, Tuhe for the Ruixi, Wandan for the Zhuijin, Pili for the Fu. The chieftains of the tribes were appointed as prefects. The Tang emperor bestowed the Chinese surname Li on the Dahe and appointed their leader to a governorship that was "an office specifically created for the indirect management of the Khitan tribes". Some Khitan tribes such as the Songmo, Xuanzhou, Neiji, Yishige, and Yishihuo were not included in the Dahe Confederation. The Neiji tribe led by Sun Aocao submitted to the Tang in 619. Aocao's great-grandson Sun Wanrong was appointed prefect of Guicheng.

Towards the turn of the century, however, Tang control of the north began to slip. The Governor-general of Yingzhou, Zhao Wenhui, regarded the Khitan chieftains as his servants. The Khitan chieftain Sun Wanrong and his brother-in-law, the governor of Songmo, Li Jinzhong, felt insulted and bullied by Zhao. In 696, a famine occurred in Khitan territory and Zhao failed to provide relief, sparking a rebellion. The Dahe leader, Li Jinzhong, captured Yingzhou and declared himself "Wushang Khagan" (paramount khagan). The Tang sent 28 generals against the Khitans but were defeated at Xiashi Gorge (Lulong County). The Tang troops continued to suffer defeat until Li Jinzhong died of disease. Qapaghan Qaghan of the Second Turkic Khaganate offered to aid the Tang in return for subdued Türkic households under Tang control. The Türks attacked the Khitans from the north while the Tang invaded from the south. The Khitans suffered a heavy defeat before Sun Wanrong rescued the situation and counterattacked, seizing Yingzhou and Youzhou. A 170,000 strong Tang army was sent against the Khitans and defeated. Another 200,000 soldiers were sent against the Khitans but failed to stop their advance. However the Khitans failed to account for the Türks sacking their capital, Xincheng, and the defection of the Kumo Xi from their ranks. Sun Wanrong was killed by his servant. Although the rebellion was defeated, it took over fifteen years from 700 to 714 before the Tang were able to reassert control over the Khitans.

In 720 the military chief (Yaguan) Ketuyu attacked the reigning Khitan ruler, Suogu. Suogu fled to Yingzhou seeking Chinese protection. General Xue Tai was ordered to punish Ketuyu but he failed and was captured along with Suogu and the Kumo Xi king Li Dapu. Ketuyu enthroned Suogu's cousin Yuyu as the new Khitan ruler. Ketuyu sent tribute to the Tang court but the official in charge treated him with rudeness. Ketuyu murdered the Khitan ruler Shaogu and defected to the Türks. Ketuyu suffered a defeat against the Tang in 732 and fled while his Kumo Xi allies surrendered to the Tang. In 734, Ketuyu defeated a Tang army with the support of his Türkic allies and then lost another battle against Tang forces under the command of Zhang Shougui. The Tang convinced a Khitan military official, Li Guozhe, to murder Ketuyu and the Khitan ruler Qulie, who had been enthroned by Ketuyu.