The Xianbei (; simplified Chinese: 鲜卑; traditional Chinese: 鮮卑; pinyin: Xiānbēi) were an ancient nomadic people that once resided in the eastern Eurasian steppes in what is today Mongolia, Inner Mongolia, and Northeastern China. The Xianbei were likely not of a single ethnicity, but rather a multilingual, multi-ethnic confederation consisting of mainly Proto-Mongols (who spoke either pre-Proto-Mongolic, or Para-Mongolic languages), and, to a minor degree, Tungusic and Turkic peoples. They originated from the Donghu people who splintered into the Wuhuan and Xianbei when they were defeated by the Xiongnu at the end of the third century BC. Following the split, the Xianbei people did not have direct contact with the Han dynasty, residing to the north of the Wuhuan. In the first century BC, the Xianbei began actively engaging in the struggle between the Han and Xiongnu, culminating in the Xianbei replacing the Xiongnu on the Mongolian Plateau.
In the mid-2nd century, the chieftain, Tanshihuai unified the Xianbei and waged war against the Han dynasty. His confederation threatened the Han's northern borders for many years, but quickly disintegrated following his death in 181 AD. After suffering several defeats by the end of the Three Kingdoms period, the Xianbei migrated southwards and settled in close proximity to Han society, submitting as vassals to the Chinese dynasties. As one of the so-called "Five Barbarians", they fought as auxiliaries for the Western Jin dynasty during the War of the Eight Princes and the Upheaval of the Five Barbarians before eventually distancing themselves and declaring their autonomy while the Jin were pushed out from northern China. During the Sixteen Kingdoms period, the Xianbei founded several short-lived states and established themselves on the Central Plains.