The Qifu (Chinese: 乞伏), also known as the Longxi Xianbei (Chinese: 隴西鮮卑) were a Xianbei clan in early medieval China. They were a western branch of Xianbei who led their tribe to migrate in the areas of modern-day Ningxia and central Gansu. During the Sixteen Kingdoms period, the Qifu founded the Western Qin dynasty, which ruled the Longxi Basin from 385 to 431 CE.
According to the Book of Jin, the Qifu originated from the Gobi Desert before migrating south towards the Yin Mountain Range. Their earliest known chieftain was known as Rufu (如弗), and the tribe initially comprised four clans, namely the Qifu, Siyin (斯引), Chilu (叱盧) and Chulian (出連). Legend has it that when the tribe was travelling, they encountered a giant reptile shaped like a "divine turtle" and "as large as a hill". After sacrificing a horse, the creature disappeared and a child took its place. An old man among the Qifu was without a son, so the clans agreed to have him adopt the child. He was given the name Hegan, and as he grew into a powerful warrior, the clans elected him as their leader, bestowing him the title of Qaghan of the Qifu, Tuoduo Mohe ("demi-god prince").
The clan name Qifu is commonly transcribed in Chinese as 乞伏 (Qǐfú). Other transcription variants of Qǐfú include 乞扶 or 乞佛, as well as Qibu (乞步; Qǐbù). As the tribe entered and settled down in the Longxi Basin in modern-day central Gansu, they were also referred to in historical records as the "Longxi Xianbei" (隴西鮮卑). However, modern studies on the surnames of the Qifu and their followers indicate that they were likely a tribal alliance between the Xianbei and the ethnic Turkic Tiele people, also known as the Gaoche or Dingling. During the Western Qin era, several of their high-ranking ministers had Tiele surnames such as Yizhan (乙旃), Wuyin (屋引) and Zhai (翟). The Twelve Surnames of the Tiele found in the Book of Wei also mentions the Qifuli (泣伏利; Qìfúlì), which may have been transcription of Qifu. Additionally, another Tiele surname, Tulu (吐盧), was likely a variant of Chilu (叱盧), one of the four original clans of the Qifu tribe.
Historian, Tang Changru, further proposed that the Qifu emerged from a mixed ethnic group of captives from the Xiongnu Empire, referred to as the "zī" (貲) or "zīlǔ" (貲虜; "chattel caitiffs") by the Xiongnu and Chinese. These captives broadly consisted of the Xianbei, Gaoche, Dingling, Qiang and Western Regions people among others. After the disintegration of the Xiongnu Empire, numerous groups of the zilu dispersed and migrated into parts of northwestern China such as in present-day Lanzhou, Gansu. Tang Changru believed that the ethnic composition and the areas where the zilu were most active corresponds with that of the Qifu tribe.