Northern Wei was established by the Tuoba clan of the Xianbei people during the Sixteen Kingdoms period. It successfully unified Northern China under Emperor Taiwu, bringing an end to the chaotic era and ushering in the Northern Dynasties period.
According to legend, the ancestors of the Tuoba clan originated from a Great Cave (Gaxian Cave) in the far north, where they lived for generations before migrating south to fulfill their destiny as rulers of the Central Plains.