In the middle of 3rd century CE, nomadic people related to the Mongolic Xianbei migrated to pasture lands around the Qinghai Lake (Koko Nur) and established the Tuyuhun Kingdom. In the 7th century, Tuyuhun Kingdom was attacked by both the Tibetan Empire and Tang dynasty as both of them sought control over trade routes. Military conflicts severely weakened the kingdom and it was incorporated into the Tibetan Empire. After the disintegration of the Tibetan Empire, small local factions emerged, some under the titular authority of China. The Song dynasty defeated the Tibetan Kokonor Kingdom in the 1070s. During the Yuan dynasty's administrative rule of Tibet, the region comprising the headwaters of the Yellow and Yangtze rivers and was known as Amdo, but apportioned to different administrative divisions than Tibet proper.