The Qarluqs (Karluks, Chinese rendering Geluolu 葛邏祿 or 葛羅祿) were a Western Türkish people that roamed the west of modern Mongolia, the north of the modern Autonomous Region of Xinjang and the eastern parts of Kazakhstan from the 7th through the 13th century. They were related to the Türkish people of the Chebi 車鼻.
The Qarluq federation consisted of three tribal groups (sanxing 三姓) called Mouluo 謀落 (or Moula 謀剌), Chisi 熾俟 (Chigil, or Pofu 婆匐), and Tashili 踏實力 led by a chieftain or khan (Türkic yabghu, Chinese transliteration yehu 葉護). The Qarluqs were first dominated by the Syr Tarduš 薛延陀, but around 650, when the Tang 唐 (618-907) general Gao Kan 高侃 defeated the Chebi, the Qarluq also accepted the suzerainty of the Tang empire.
The khan of the Mouluo was in 657 appointed commander-in-chief (dudu 都督) of the area commands (dudufu 都督府) of Yinshan 陰山, the khan of the Chisi was made commander-in-chief of Damo 大漠, and that of the Tashili commander-in-chief of Xuanchi 玄池. The territory of the Chisi was later divided into the indirectly administered prefectures (jimizhou 羈糜州) of Damo and Jinfu 金附. The fate of the region west of the Altai Range was subject to the formation and disintegration of tribal federtions of the Türkic peoples.
In 742 the Qarluqs joined the Uyghurs 回紇 and Bašmyls 拔悉密 in a war against the ruler of the later Türkish khanate, Usmiš Khan 烏蘇米施可汗, and elected the khan of the Bašimi, Ašna Shi 阿史那施, as the highest khan of the Türks. He adopted the title of Jiedieyiš Khan 頡跌伊施可汗, while the khans of the Qarluqs and the Uyghurs acted as his left and right sub-khans (yabghu). The two sub-khans in 744 decided to get rid of the domination by the Bashimi and killed Jiedieyiš Khan. The position of highest khan was taken over by the yabghu of the Uyghurs, Gulipeiluo 骨力裴羅 (or Yibiaobi 逸標苾) who adopted the title of Qutlugh Bilgä Köl Khan 骨咄祿毗伽闕可汗.
The Qaruluqs accepted the overlordship of the Uyghur Khan, also, when he was granted the title of Huairen Khan 懷仁可汗 by the Tang court in 746. From the 760s on the power of the Qaruluqs grew and they occupied the territory formerly occupied by the Türgiš 突騎施 along the River Chuhe 楚河, including the cities of Suiye 碎葉 and Daluosi 怛邏斯 (Talas). In 789 the Qarluqs joined their forces with the kingdom of Tubo 吐蕃 (Tibet) to attacke the Uyghur khanate. The victory was not for long, and the allies were defeated by the Uyghurs. The Qarluqs were forced to withdraw and migrated somewhat farther to the west, where they occupied a territory between the Kirghizes 黠戛斯 in the north, the Uyghurs in the east, the Tibet kingdom in the south, and Persia (Dashi 大食) to the west. When the Uyghur khanate disintegrated in 840 numerous Uyghurs migrated towards the west and settled down in the territory of the Qarluqs.
From the 10th century on the Qarluqs are known as Halalu 哈剌魯 in Chinese sources. It is the time when the Karakhan Empire 黑汗 came into being.