Northern Wei

Wei, known in historiography as the Northern Wei , Tuoba Wei , Yuan Wei and Later Wei , was an imperial dynasty of China ruled by the Tuoba (Tabgach) clan of the Xianbei. The first of the Northern dynasties, it ruled northern China from 386 to 535 during the period of the Northern and Southern dynasties. Described as "part of an era of political turbulence and intense social and cultural change", the Northern Wei dynasty is particularly noted for unifying northern China in 439, bringing an end to the chaotic Sixteen Kingdoms period, and strengthening imperial control over the rural landscape via reforms in 485. This was also a period of introduced foreign ideas, such as Buddhism, which became firmly established. The Northern Wei was referred to as "Plaited Barbarians" (索虜; suǒlǔ) by writers of the Southern dynasties, who considered themselves the true upholders of Chinese culture.

During the Taihe period (477–499), Empress Dowager Feng and Emperor Xiaowen instituted sweeping reforms that deepened the dynasty's control over the local population in the Han hinterland. Emperor Xiaowen also introduced changes that eventually led to the dynasty moving its capital from Datong to Luoyang, in 494. The Tuoba adopted the surname Yuan (元) as a part of systematic sinicization.

Many antiques and art works, both Taoist art and Buddhist art, from this period have survived. It was the time of the construction of the Yungang Grottoes near Datong during the mid-to-late fifth century, and towards the latter part of the dynasty, the Longmen Grottoes outside the later capital city of Luoyang, in which more than 30,000 Buddhist images from the time of this dynasty have been found.

Towards the end of the Northern Wei dynasty there was significant internal dissension, resulting in a split into the Eastern Wei and the Western Wei dynasties under the rule of the same imperial house in 534–535, which were soon replaced by the Northern Qi and the Northern Zhou dynasties respectively. While the rule of Tuoba clan ended in the mid-6th century CE, its important policies, in particular the political recentralization reforms under Empress Dowager Feng and ethnic integration under Emperor Xiaowen, had a long-lasting impact on later periods of Chinese history.

Rise of the Tuoba Xianbei
The Jin dynasty had developed an alliance with the Tuoba against the Xiongnu state Han-Zhao. In 315, the Tuoba chief, Tuoba Yilu was granted the title of Prince of Dai. After his death, however, the Dai state stagnated, and with the Jin ejected from northern China, the Dai largely remained a partial ally and a partial tributary state to Later Zhao and Former Yan, finally falling to Former Qin in 376.

After Former Qin's emperor Fu Jiān was defeated by Jin forces at the Battle of Fei River in his failed bid to unify China, the Former Qin state began to break apart. By 386, Tuoba Gui (Emperor Daowu of Northern Wei), the son (or grandson) of Tuoba Shiyijian (the last Prince of Dai), reasserted Tuoba independence initially as the Prince of Dai. Later he changed his title to the Prince of Wei, and his state was therefore known as Northern Wei. In 391, Tuoba Gui defeated the Rouran tribes and killed their chief, Heduohan, forcing the Rouran to flee west.

At first, the Northern Wei was internally unstable and allied with the stronger Xianbei-led Later Yan dynasty that ruled most of present-day Hebei and Liaoning. As Wei grew in power by subjugating neighbouring tribes, their alliance came to and end in 391, when Tuoba Gui refused to send more tribute after Yan detained his brother at their capital, and the Wei re-aligned themselves with the Western Yan in Shanxi. Wei continued hostilities even after Western Yan fell in 394, and in 395, the Later Yan emperor, Murong Chui, sent his Crown Prince, Murong Bao, with a massive army to lead a punitive expedition against Wei. However, at the Battle of Canhe Slope, Tuoba Gui inflicted the Later Yan army a heavy defeat.

In 396, Murong Chui personally led another campaign against Wei, but though he was initially successful, the Yan troops withdrew after he became deathly ill, and he soon died on his way back. Shortly after Murong Bao ascended the throne, Tuoba Gui began an invasion on Later Yan. During the invasion, Murong Bao decided to concentrate his forces in his capital and major cities, allowing the Wei forces to quickly overrun the Central Plains. A disastrous defeat at the Battle of Baisi and infighting among the imperial family finally forced the Later Yan to evacuate to Liaoning, while a branch in the south founded the Southern Yan in 398 before escaping to Shandong.

With a strong foothold on the Central Plains and the Yan state split into two, Northern Wei became a regional power in northeastern China, competing with the Qiang-led Later Qin dynasty to the west and the Eastern Jin dynasty to the south for a time. In 398, Tuoba Gui relocated the capital to Pingcheng, and in 399, he elevated his title to Emperor of Wei. After Tuoba Gui's assassination in 409, his son, Tuoba Si (Emperor Mingyuan of Northern Wei) took the throne and continued his father's efforts to consolidate their state.

Unification of Northern China
In 423, Emperor Taiwu of Northern Wei ascended the throne and sought to reunify northern China. In 426, he made the Xiongnu-led Hu Xia dynasty his target. He sent his generals to attack Puban (modern Yuncheng) and Shancheng (modern Sanmenxia), while he himself laid siege to the Hu Xia's heavily fortified capital of Tongwancheng. Tongwancheng fell in 427, forcing the Hu Xia emperor Helian Chang to flee westward. Nevertheless, he was captured in 428 and his brother, Helian Ding, took over as the emperor of Hu Xia.

In fall of 430, while Helian Ding was engaging the Western Qin dynasty, the Northern Wei made a surprise attack on the new Hu Xia capital Pingliang and conquered the state.

In summer 432, Emperor Taiwu, with Hu Xia destroyed, began to attack the Northern Yan dynasty and its capital Helong (和龍, in modern Jinzhou, Liaoning) under siege. He chose to withdraw at the start of winter and would launch yearly attacks against the Northern Yan to weaken it gradually over the next few years. In 436 the Northern Yan emperor Feng Hong (Emperor Zhaocheng) had to evacuate his state and fled to Goguryeo, ending the Northern Yan.

In 439, the Northern Wei launched a major attack on the Northern Liang dynasty, capturing its capital Guzang (modern Wuwei, Gansu). By 441, the entirety of the Northern Liang was under the Northern Wei. Thus, northern China was unified under Emperor Taiwu, ending the Sixteen Kingdoms era and beginning the Northern and Southern dynasties era.

In 446, an ethnic Qiang rebellion was crushed by the Northern Wei. Wang Yu (王遇) was an ethnic Qiang eunuch and he may have been castrated during the rebellion since the Northern Wei would castrate the rebel tribe's young elite. Fengyi prefecture's Lirun town according to the Book of Wei was where Wang Yu was born. Lirun was northeast of Xi'an by 100 mile and modern day Chengcheng stands at its site. Wang Yu patronized Buddhism and in 488 had a temple constructed in his birthplace.

War with Liu Song
War between Northern Wei and Han-ruled Liu Song dynasty broke out while the former had not yet unified northern China. Emperor Wu of Song while still a Jin dynasty general, had conquered both Southern Yan in 410 and Later Qin in 417, pushing Jin frontiers further north into Wei territories. He then usurped the Jin throne and created the Song dynasty. After hearing the death of the Song emperor Wu in 422, Wei's emperor Mingyuan broke off relations with Song and sent troops to invade its southern neighbor. His plan is to seize three major cities south of the Yellow River: Luoyang, Hulao, and Huatai. Sizhou (司州, central Henan) and Yanzhou (兗州, modern western Shandong) and most cities in Song's Qing Province (青州, modern central and eastern Shandong) fell to the Wei army. The Liu Song general Tan Daoji commanded an army to try to save those cities and were able to hold Dongyang (東陽, in modern Qingzhou, Shandong), the capital of Qingzhou province. Northern Wei troops were eventually forced to withdraw after food supplies ran out. Wei forces also stalled in their siege of Hulao, defended by the capable Liu Song general Mao Dezu (毛德祖), but were meanwhile able to capture Luoyang and Xuchang (許昌, in modern Xuchang, Henan) in spring 423, cutting off the path of any Liu Song relief force for Hulao. In summer 423, Hulao fell. The campaign then ceased, with Northern Wei now in control of much of modern Henan and western Shandong.

Emperor Wen of Song continued the northern campaigns of his father. In 430, under the able general Dao Yanzhi, Liu Song recovered the four cities of Luoyang, Hulao, Huatai and Qiao'ao south of the Yellow River. However, the emperor's unwillingness to advance past this line caused the destruction of the empire's ally, Xia, by the Wei. The emperor was to repeat this mistake as several northern states such as Northern Yan who had offered to ally with Liu Song against Wei were declined, eventually leading to Wei's unification of the North in 439.

In 450, Emperor Wen attempted to destroy the Northern Wei by himself and launched a massive invasion. Although initially successful, the campaign turned into a disaster. The Wei lured the Liu Song to cross the Yellow River, and then flanked them, destroying the Eastern army.

As the Liu Song armies retreated, Emperor Taiwu ordered his troop to move south. The provinces south of the Yellow River were devastated by the Wei army. Only Huatai, a fortified city, held out against the Wei. Wei troops retreated in January 451, however, the economic damage to the Song was immense. Emperor Wen made another attempt to conquer Northern Wei in 452, but failed again. On returning to the capital, he was assassinated by the heir apparent, Liu Shao.

In 466, Liu Zixun waged an unsuccessful civil war against the Emperor Ming of Liu Song. The governors of Xu Province (徐州) and Yan Province (兗州, modern western Shandong), who earlier pleaded allegiance to Liu Zixun, in fear of reprisal from the Liu Song emperor Emperor Ming, surrendered these territories to rival Northern Wei. Northern Wei forces quickly took up defense position against the attacking forces sent by Emperor Ming. With Liu Song forces unable to siege Pengcheng effectively, they were forced to withdraw in spring 467, making these populous provinces lost to the Northern Wei.

War with Southern Qi
In 479, Xiao Daocheng usurped the throne of Liu Song and became emperor of the new Southern Qi dynasty. Upon hearing the news, the Northern Wei emperor prepared to invade under the pretext of installing Liu Chang, son of Emperor Wen of Song who had been in exile in Wei since 465 AD.

Wei troops began to attack Shouyang but could not take the city. The Southern Qi began to fortify their capital, Jiankang in order to prevent further Wei raids.

Multiple sieges and skirmishes were fought until 481 but the war was without any major campaign. A peace treaty was signed in 490 with the Emperor Wu.

War with Liang
In 502, the Southern Qi general Xiao Yan toppled the emperor Xiao Baojuan after waging a three-year civil war against him. Xiao Yan enthroned in Jiankang to become Emperor Wu of the Liang dynasty.

As early as 503 AD, the Northern Wei was hoping to restore the Southern Qi throne. Their plan was to install Xiao Baoyin, a Southern Qi prince, to become emperor of the puppet state. A southern expedition was led by Prince Yuan Cheng of Wei and Chen Bozhi, a former Qi general. Until spring 505, Xinyang and Hanzhong were fallen to the Northern Wei.

In 505, Emperor Wu began the Liang offensive. A strong army was quickly amassed under the general Wei Rui and caught the Wei by surprise, calling it the strongest army they have seen from the Southern dynasties in a hundred years. In spring 506, Wei Rui was able to capture Hefei. In fall 506, Wei Rui attacked the Northern Wei army stationed at Luokou for nearly a year without advancing. However, when Wei army gathered, Xiao Hong Prince of Linchuan, the Liang commander and younger brother of Emperor Wu, escaped in fear, causing his army to collapse without a battle. Northern Wei forces next attacked the fortress of Zhongli (鍾離, in modern Bengbu), However, they were defeated by a Liang army commanded by Wei Rui and Cao Jingzong, effectively ending the war. After the Battle of Zhongli, there would continue to be border battles from time to time, but no large-scale war for years.

In 524, while Northern Wei is plagued by agrarian rebellions to the north and west, Emperor Wu launched a number of attacks on Wei's southern territory. Liang forces largely met little resistance. In spring 525, the Northern Wei general Yuan Faseng (元法僧) surrendered the key city of Pengcheng (彭城, in modern Xuzhou, Jiangsu) to Liang. However, in summer 525, Emperor Wu's son Prince Xiao Zong (蕭綜), grew suspicions that he was actually the son of Southern Qi's emperor Xiao Baojuan (because his mother Consort Wu was formerly Xiao Baojuan's concubine and had given birth to him only seven months after she became Emperor Wu's concubine), surrendered Pengcheng to Northern Wei, ending Liang's advances in the northeast, although in summer 526, Shouyang fell to Liang troops after Emperor Wu successfully reemployed the damming strategy. For the next several years, Liang continued to make minor gains on the borders with Northern Wei.

In 528, after a coup in Northern Wei, with the warlord Erzhu Rong overthrowing Empress Dowager Hu, a number of Northern Wei officials, including Yuan Yue, Yuan Yu, and Yuan Hao fled and surrendered territories they controlled to Liang. In winter 528, Emperor Wu created Yuan Hao the Prince of Wei—intending to have him lay claim to the Northern Wei throne and, if successful, become a Liang vassal. He commissioned his general Chen Qingzhi (陳慶之) with an army to escort Yuan Hao back to Northern Wei. Despite the small size of Chen's army, he won battle after battle, and in spring 529, after Chen captured Suiyang (modern Shangqiu). Yuan Hao, with Emperor Wu's approve, proclaimed himself the emperor of Northern Wei. In summer 529, troops under Erzhu unable to stand up to Chen Qingzhi, forcing Emperor Xiaozhuang of Northern Wei to flee the capital Luoyang. After capturing Luoyang, Yuan Hao secretly wanted to rebel against Liang: when Chen Qingzhi requested Emperor Wu to send reinforcements, Yuan Hao sent Emperor Wu a submission advising against it, and Emperor Wu, believing Yuan Hao, did not send additional troops. Soon, Erzhu and Emperor Xiaozhuang counterattacked, and Luoyang fell. Yuan Hao fled and was killed in flight, and Chen's own army was destroyed, although Chen himself was able to flee back to Liang.

In 530, Emperor Wu made another attempt to establish a vassal regime in Northern Wei by creating Yuan Yue the Prince of Wei, and commissioning Yuan Yue's uncle Fan Zun (范遵) with an army to escort Yuan Yue back to Northern Wei. Yuan Yue made some advances, particularly in light of the disturbance precipitated soon thereafter when Emperor Xiaozhuang ambushed and killed Erzhu Rong and was in turn overthrown by Erzhu Rong's nephew Erzhu Zhao and cousin Erzhu Shilong. However, Yuan Yue realized that the Erzhus then became firmly in control of Luoyang and that he would be unable to defeat them, and so returned to Liang in winter 530.

In 532, with Northern Wei again in civil war after the general Gao Huan rose against the Erzhus, Emperor Wu against sent an army to escort Yuan Yue back to Northern Wei, and subsequently, Gao Huan welcomed Yuan Yue, but then decided against making Yuan Yue emperor. Subsequently, Emperor Xiaowu of Northern Wei, whom Gao made emperor, had Yuan Yue executed.

With Northern Wei divided into Eastern Wei and Western Wei in light of Emperor Xiaowu's flight, Emperor Wu initially continued to send his forces to make minor territorial gains on the borders, against both Eastern Wei and Western Wei, for several years.

Policies
Early in Northern Wei history, the state inherited a number of traditions from its initial history as a Xianbei tribe, and some of the more unusual ones, from a traditional Chinese standpoint, were:
 * The officials did not receive salaries until Empress Dowager Feng took power, but were expected to requisition the necessities of their lives directly from the people they governed. As Northern Wei Empire's history progressed, this appeared to be a major contributing factor leading to corruption among officials. Not until the second century of the empire's existence did the state begin to distribute salaries to its officials.
 * Empresses were not named according to imperial favors or nobility of birth, but required that the candidates submit themselves to a ceremony where they had to personally forge golden statues, as a way of discerning divine favor. Only an imperial consort who was successful in forging a golden statue could become the empress.
 * All men, regardless of ethnicity, were ordered to tie their hair into a single braid that would then be rolled and placed on top of the head, and then have a cap worn over the head.
 * When a crown prince is named, his mother, if still alive, must be forced to commit suicide. According to some historians, this may not have been a Tuoba traditional custom, but believed it to be a tradition instituted by the founding emperor Emperor Daowu based on Emperor Wu of Han's execution of his favorite concubine Consort Zhao, the mother of his youngest son Liu Fuling (the eventual Emperor Zhao), before naming Prince Fuling crown prince.
 * As a result, because emperors would not have mothers, they often honored their wet nurses with the honorific title, "Nurse Empress Dowager" (保太后, bǎo tài hòu).

As Sinicization of the Northern Wei state progressed, these customs and traditions were gradually abandoned.

After building a Chinese-style capital at Ye, Tuoba Gui sought to break the autonomy of the tribes. He reorganised the people into eight artificial tribes forcibly settled around the capital, which served as military units. He also removed the traditional tribal leaders. These reforms helped to change tribal loyalties and strengthen their loyalty to the dynasty. These tribes served as the Emperor's personal professional military caste which helped to sustain the dynasty against any threats.

The Reform under Empress Dowager Feng
After securing Xianbei hegemony in the hinterland of China, the North Wei regime, under the rule of Empress Dowager Feng (438-490; also known as Empress Dowager Wenming) implemented a package of reforms in 485-486 AD, greatly solidifying its fiscal foundations and strengthening state penetration to the local society.

This reform introduced two far-reaching policies, namely, the "equal-field landholding system", and the "three-elder system". In the new "equal-filed system" (juntian zhi) unveiled in 485, the state redistributed abandoned or uncultivated land to commoner subjects attached with obligations of tax duty in the forms of grain, cloth, and labor service. In principle, each household was entitled to lands proportional to its labor power. Specifically, two types of land with tenure were assigned to a household: the first was open land for crop cultivation (40 mu ) for each adult male in the household, and half those amounts for adult females which was returnable after the recipient reached a specific advanced age or died. The second was the land to support textile production (10 or 20 mu, with the same gender distribution principle as open land) in one of two forms, namely, "mulberry lands" in silk-producing areas, and "hemp lands" in regions where sericulture was infeasible. Importantly, mulberry land was inheritable because of the long-term investment and care mulberry orchards required. Households possessing slaves and plow oxen were entitled to substantially larger allocations. The open land allocations would be doubled or tripled in areas where the land was less fertile or the population sparse. Sale of these land grants was forbidden, although subleasing was permitted under some circumstances. Land allocations would be adjusted annually to account for changes in the composition of the household and its number of oxen.

Another policy was the establishment of the three-elders system (sanzhang-zhi) in 486, which was designed to compile accurate population registers and to integrate village society into the state administration. In this system, five households were to make up one neighborhood (li), headed by one neighborhood elder (linzhang) while five neighborhoods were grouped into a village and headed by one village elder (lizhang). Finally, over five villages, there was one ward elder (dangzhang). The three elders, appointed by the government, were responsible for detecting and re-registering population outside of state accounts, requisitioning corvee labor and taxes, and taking care of the poor and orphaned under their jurisdiction. This policy significantly bolstered the state's control over the common people.

The reforms of Empress Dowager Feng boosted agricultural production and tax receipts on a long-term basis, and broke the economic power of local aristocrats who sheltered residents under their control living in fortified villages that dotted the rural landscape of the North from taxation. The Northern Wei dynasty had doubled the registered population to more than 5 million households since the reforms.

These institutional infrastructures erected by the Northern Wei state survived the fall of the dynasty and paved the way for China's eventual unification in 589 AD under the Sui dynasty.

Later reforms
The Northern Wei used the previous dynasties' Nine-rank system as a way of assigning official positions to wealthy and prestigious Han Chinese families, according to hereditary rank. Officials were also given considerable autonomy, such as appointing subordinate officials.

Deportations
During the reign of Emperor Daowu (386–409), the total number of deported people from the regions east of Taihangshan (the former Later Yan territory) to Datong was estimated to be around 460,000. Deportations typically took place once a new piece of territory had been conquered.

Sinicization
As the Northern Wei state grew, the emperors' desire for Han Chinese institutions and advisors grew. Cui Hao (381–450), an advisor at the courts in Datong played a great part in this process. He introduced Han Chinese administrative methods and penal codes in the Northern Wei state, as well as creating a Taoist theocracy that lasted until 450. The attraction of Han Chinese products, the royal court's taste for luxury, the prestige of Chinese culture at the time, and Taoism were all factors in the growing Chinese influence in the Northern Wei state. Chinese influence accelerated during the capital's move to Luoyang in 494 and Emperor Xiaowen continued this by establishing a policy of systematic sinicization that was continued by his successors. Xianbei traditions were largely abandoned. The royal family took the sinicization a step further by changing their family name to Yuan. Marriages to Chinese families were encouraged. With this, Buddhist temples started appearing everywhere, displacing Taoism as the state religion. The temples were often created to appear extremely lavish and extravagant on the outside of the temples. Also from 460 onwards the emperors started erecting huge statues of the Buddha carved near their capital Pingcheng which declared the emperors as the representatives of the Buddha and the legitimate rulers of China.

The Northern Wei started to arrange for Han Chinese elites to marry daughters of the Xianbei Tuoba royal family in the 480s. More than fifty percent of Tuoba Xianbei princesses of the Northern Wei were married to southern Han Chinese men from the imperial families and aristocrats from southern China of the Southern dynasties who defected and moved north to join the Northern Wei. Some Han Chinese exiled royalty fled from southern China and defected to the Xianbei. Several daughters of the Xianbei Emperor Xiaowen of Northern Wei were married to Han Chinese elites, the Liu Song royal Liu Hui 劉輝), married Princess Lanling (蘭陵公主) of the Northern Wei,     Princess Huayang (華陽公主) to Sima Fei (司馬朏), a descendant of Jin dynasty (266–420) royalty, Emperor Xiaozhuang of Northern Wei's sisters, the Shouyang Princess, was wedded to the Liang dynasty ruler Emperor Wu of Liang's son Xiao Zong 蕭綜. One of Emperor Xiaowu of Northern Wei's sisters was married to Zhang Huan, a Han Chinese, according to the Book of Zhou (Zhoushu). His name is given as Zhang Xin in the Book of Northern Qi (Bei Qishu) and History of the Northern Dynasties (Beishi) which mention his marriage to a Xianbei princess of Wei. His personal name was changed due to a naming taboo on the emperor's name. He was the son of Zhang Qiong.

When the Eastern Jin dynasty ended Northern Wei received the Han Chinese Jin prince Sima Chuzhi (司馬楚之) as a refugee. A Northern Wei Princess married Sima Chuzhi, giving birth to Sima Jinlong (司馬金龍). Northern Liang Xiongnu King Juqu Mujian's daughter married Sima Jinlong.

The Northern Wei's Eight Noble Xianbei surnames (八大贵族) were the Buliugu (步六孤), Helai (賀賴), Dugu (獨孤), Helou (賀樓), Huniu (忽忸), Qiumu (丘穆), Gexi (紇奚), and Yuchi (尉遲). They adopted Chinese last names.

Kongzi was honoured in sacrifices as was Earth and Heaven by the northern dynasties of non-Han origin. Kongzi was honored by the Murong Wei Former Yan Xianbei leader. Kongzi was honored by the Di ruler Fu Jian (337–385). Kongzi was honored in sacrifices by the Northern Wei Xianbei dynasty. Kongzi was honored by Yuoba Si, the Mingyuan emperor. Han dynasty emperors, Shang dynasty ruler Bigan, Emperor Yao and Emperor Shun were honored by Yuoba Si, the Mingyuan Emperor. Kongzi was honored extensively by Tuoba Hong, the Xiaowen Emperor.

A fief of 100 households and the rank of (崇聖侯) Marquis who worships the sage was bestowed upon a Confucius descendant, Yan Hui's lineage had 2 of its scions and Confucius's lineage had 4 of its scions who had ranks bestowed on them in Shandong in 495 and a fief of ten households and rank of (崇聖大夫) Grandee who venerates the sage was bestowed on Kong Sheng (孔乘) who was Confucius's scion in the 28th generation in 472 by Emperor Xiaowen of Northern Wei.

An anti-Buddhist plan was concocted by the Celestial Masters under Kou Qianzhi along with Cui Hao under the Taiwu Emperor. The Celestial Masters of the north urged the persecution of Buddhists under the Taiwu Emperor in the Northern Wei, attacking Buddhism and the Buddha as wicked and as anti-stability and anti-family. Anti Buddhism was the position of Kou Qianzhi. There was no ban on the Celestial Masters despite the nonfullfilment of Cui Hao and Kou Qianzhi's agenda in their anti-Buddhist campaign.

Cui Zhen's wife Han Farong was buried in a Datong located grave.

Building the Great Wall
To resist the threats posed by the Rourans, Northern Wei emperors started to embark on building its own Great Wall, the first since the Han dynasty. In 423, a defence line over 2,000 li (1080 km) long was built; its path roughly followed the old Zhao wall from Chicheng County in Hebei Province to Wuyuan County, Inner Mongolia. In 446, 100,000 men were put to work building an inner wall from Yanqing, passing south of the Wei capital Pingcheng, and ending up near Pingguan on the eastern bank of the Yellow River. The two walls of Northern Wei formed the basis of the double-layered Xuanfu–Datong wall system that protected Beijing a thousand years later during the Ming dynasty.

Governance
Local society in northern China was not governed by civil bureaucrats but by military clientage during the reign of the Northern Wei Xianbei emperors, with the local Han Chinese aristocratic families jointly ruling and controlling power with them. The Han Chinese aristocrat families ruled over their private fiefs (home jurisdictions) with large military authority and civil authority as entrusted to them by the Xianbei emperor. The Xianbei emperor also turned their own Xianbei nomad warriors into a hereditary military caste and extinguish their tribal loyalties. To the consternation of the Xianbei nobles, Han Chinese aristocrats started to be appointed to government positions by the Northern Wei emperors when the Central Plains population regrew in the middle of the 5th century.

Han Chinese commoners started pledging their allegiance as buqu (部曲) (armed retainers) to elite Han Chinese aristocratic magnates in their wubao (塢堡) (fortified settlements) when the local communities relied on the magnates to direct their defense after the 311 sack of Luoyang. Oaths were pledged in alliances between paramount commanders who joined their fortress villages together in leagues. The magnates retained the services and fealty of their thrall retainers after the fighting was over. Subject to the emperor was overtaken by the concept of village membership. Magnates had both unrelated bondsmen, private clients and fellow clan kinsmen in their armies. 50 to 60 square leagues of farmland in Hebei's southwest Taihang mountain foothills were taken as a fief by thousands of members of the Han Chinese aristocratic Zhaojun Li clan under the leader of a cadet leader of the clan, Li Xianfu. Clan loyalties were extensively utilized by local magnates. Li Xianfu was appointed as zongzhu (宗主) (clan chief) by the clan collectively in spite of him not inheriting the officer and rank of his father which went to his elder brother. Local level order was controlled by Li Xiangu and other magnates and the Northern Wei Xianbei monarchs had to rely on them. The Northern Wei gave them title of governors officially in their fiefs.

In Shanxi and Hebei the magnate clans became even more powerful and local society was dominated by them and they experienced increased solidarity due to Northern Wei patronage. These arrangement with local Han Chinese aristocratic magnate clans led to a lack of soldiers and revenue directly under the control of the Northern Wei state itself. Particularly after the 460s when Liu Song held Huaibei and Shandong were taken by the Northern Wei they needed soldiers and tax revenue. Nobles, officials and meritorious generals received large amounts of lihu (隸戶) or tongli (僮隸) (bondservants) from war captives in according with Xianbei nomad tradition during wars. These bondservants, compared to the past, made up a large part of the farming population under Northern Wei. The zahu (雜戶) (service households) made out of artisans, weavers, salt makers, entertainers, clerks were also turned into hereditary occupations among war captives captured by Northern Wei, while privately entertainers and craftsmen were also attached to magnate families. The few independent farmers under Northern Wei were subjected to the demands of corvée labor from the states due to the fact that Xianbei noble and Han Chinese aristocratic households controlled the majority of the population as retainers.

The Northern Wei attempted to back up its thinly stretched Xianbei warriors by conscription Han Chinese free subjects into their military in 473 but this only let to the magnates gaining more private client retainers as the Han Chinese farmers chose to became retainers to evade the conscription and corvée. These were the regions for the reforms under Empress Dowager Wenming (438-90) when she tried to turn the state into a Han Chinese style bureaucratic centralized empire. She reigned as regent for her grandson Emperor Xiaowen and brought into the Northern Wei government Han Chinese aristocrats. The capital was moved to the Central Plain's Luoyang away from Pingcheng in 493 by Emperor Xiaowen. The system of having retainers (buqu) existed in the Xin dynasty to the Tang dynasty and was part of the Northern Wei.

Disunity and breakup
The fall of Northern Wei began with rebellions staged by Six Garrison populations. This rebellion was rooted in the internal struggle within the Six Garrisons between upper-class military elites and lower-class soldiers and ethnic settlers. Six Garrisons were established to protect the Northern Wei regime from the invasion of Rouran and consisted of numerous ethnic groups, such as Xianbei, Gaoche, and Xiongnu as well as Han Chinese. Tribes were the basic social units, although grouped into militarized garrisons. The upper-class military elites who occupied governing offices mainly included the middle-to-low aristocrats of the Xianbei, other tribe chiefs, and Han strongmen. The internal conflict between upper-class military elites and lower-class soldiers and ethnic settlers was on the basis of the vulnerable economic base (heavily relied on livestock production and the support from the central government) and harsh environmental conditions in Six Garrison areas. The struggle for survival drove military officers of Six Garrisons to implement unfair policies biased to their own ethnic groups at the cost of others. The cause of these wars was the growing rift between the governing aristocracy which was increasingly adopting Han-style sedentary policies and lifestyles and their nomadic tribal armies who continued to preserve the old steppe way of life.

Six Frontier Towns rebellions
Rebellions broke out on six major garrison-towns on the northern border and spread like wildfire throughout the north. These rebellions lasted for a decade.

In 523, nomadic Rouran tribes suffered a major famine due to successive years of drought. In April, the Rouran Khan sent troops to raid the Wei territory. People of the town rose up and killed the town's commander. Rebellion soon broke out against across the region. In Woye, Poliuhan Baling (破六韓拔陵) became a rebel leader. His army quickly took Woye and laid siege to Wuchuan and Huaishuo.

Elsewhere in Qinzhou (Gansu), Qiang ethnic leaders such as Mozhe Dati (莫折大提) also rose up against the government. In Gaoping (present-day Guyuan), Hu Chen (胡琛) and the Xiongnu rebelled and titled himself the King of Gaoping. In Hebei, Ge Rong rebelled, proclaiming himself the Emperor of Qi.

The Poliuhan Baling rebellion was defeated in 525. Similar rebellions had spread to other regions such as Hebei and Guanzhong and were pacified by 530.

Rise of Erzhu Rong and Heyin Massacre
Exacerbating the situation, Empress Dowager Hu poisoned her own son Emperor Xiaoming in 528 after Emperor Xiaoming showed disapproval of her handling of the affairs as he started coming of age and got ready to reclaim the power that had been held by the empress in his name when he inherited the throne as an infant, giving the Empress Dowager rule of the country for more than a decade. Upon hearing the news of the 18-year-old emperor's death, the general Erzhu Rong, who had already mobilised on secret orders of the emperor to support him in his struggle with the Empress Dowager Hu, turned toward Luoyang. Announcing that he was installing a new emperor chosen by an ancient Xianbei method of casting bronze figures, Erzhu Rong summoned the officials of the city to meet their new emperor. However, on their arrival, he told them they were to be punished for their misgovernment and butchered them, throwing the Empress Hu and her candidate (another puppet child emperor Yuan Zhao) into the Yellow River. Reports estimate 2,000 courtiers were killed in this Heyin massacre on the 13th day of the second month of 528. Erzhu Rong claimed Yuan Ziyou grandson of Emperor Xianwen the new emperor as Emperor Xiaozhuang of Northern Wei.

In 529, Liang general Chen Qingzhi sacked Luoyang, forced Emperor Xiaozhuang to flee and claimed Yuan Hao another grandson of Emperor Xianwen emperor, before his final defeat by Erzhu Rong.

Civil war and the two generals
The Erzhu clan dominated the imperial court thereafter, the emperor held power in name only and most decisions actually went through the Erzhus. The emperor did stop most of the rebellions, largely reunifying the Northern Wei state. However, Emperor Xiaozhuang, not wishing to remain a puppet emperor and highly wary of the Erzhu clan's widespread power and questionable loyalty and intentions towards the throne (after all, this man had ordered a massacre of the court and put to death a previous emperor and empress before), killed Erzhu Rong in 530 in an ambush at the palace, which led to a resumption of civil war, initially between Erzhu's clan and Emperor Xiaozhuang, and then, after their victory over Emperor Xiaozhuang in 531, between the Erzhu clan and those who resisted their rule. In the aftermath of these wars, two generals set in motion the actions that would result in the splitting of the Northern Wei into the Eastern and Western Wei.

General Gao Huan was originally from the northern frontier, one of many soldiers who had surrendered to Erzhu, who eventually became one of the Erzhu clan's top lieutenants. But later, Gao Huan gathered his own men from both Han and non-Han troops, to turn against the Erzhu clan, entering and taking the capital Luoyang in 532. Confident in his success, he deposed Emperor Jiemin of Northern Wei, the emperor supported by the Erzhu clan, as well as Yuan Lang the emperor previously supported by Gao himself, and set up a new emperor Emperor Xiaowu of Northern Wei on the Luoyang throne and continued his campaigns abroad. The emperor, however, together with the military head of Luoyang, Husi Chun, began to plot against Gao Huan. Gao Huan succeeded, however, in keeping control of Luoyang, and the emperor and a handful of followers fled west, to the region ruled by the powerful warlord Yuwen Tai. Gao Huan then announced his decision to move the Luoyang court to his capital city of Ye. "Within three days of the decree, 400,000 families—perhaps 2,000,000 people—had to leave their homes in and around the capital to move to Yeh as autumn turned to winter." There now existed two rival claimants to the Northern Wei throne, leading to the state's division in 534–535 into the Eastern Wei and Western Wei. The Eastern Wei were initially significantly stronger and looked likely to end Western Wei quickly, but were defeated at the Battle of Shayuan in 537, confirming the split of the Northern Wei

Fall
Neither Eastern Wei nor Western Wei was long-lived. In 550, Gao Huan's son Gao Yang forced Emperor Xiaojing of Eastern Wei to yield the throne to him, ending Eastern Wei and establishing the Northern Qi. Similarly, in 557, Yuwen Tai's nephew Yuwen Hu forced Emperor Gong of Western Wei to yield the throne to Yuwen Tai's son Yuwen Jue, ending the Western Wei and establishing the Northern Zhou. In 581, the Northern Zhou official Yang Jian had the emperor to yield the throne to him, establishing the Sui dynasty.

Legacy and culture
The Northern Wei dynasty was the most long-lived and most powerful of the northern dynasties prior to the reunification of China by the Sui dynasty. Its most important legacy was the sweeping reforms introduced under Empress Dowager Feng and continued under her successors. While the dynasty officially ended in 557, these reforms, especially the equal-field landholding system, lasted until the mid-eight century CE. The reforms completely reshaped China's political development as they reverted the trends associated with feudalism in earlier times (c. second to fifth centuries CE) such as the devolution of power to local strongmen and political fragmentation. Historians generally credit the Northern Wei dynasty for laying the foundation for China's eventual reunification under the Sui dynasty. Ray Huang, for example, pointed out that these reforms brought about the "infrastructure of a regenerated empire" and new rulers after Northern Wei, such as Yang Jian of the Sui dynasty, would inherit "the bulk of the agricultural resources and the peasant manpower" made available via the reforms to reunify the whole of China.

Many of the most important heritages of China, such as the Yungang Grottoes, the Longmen Caves, the Shaolin Monastery, the Songyue Pagoda, were built by the Northern Wei. Important books such as Qimin Yaoshu and Commentary on the Water Classic, a monumental work on China's geography, was written during the era.

The legend of Hua Mulan is originated from the Northern Wei era, in which Mulan, disguised as a man, takes her aged father's place in the Wei army to defend China from Rouran invaders.

Central Asian influences
Northern Wei art came under influence of Indian and Central Asian traditions through the mean of trade routes. A Central Asian (胡) named An Ton (安同), a descendant of the Parthian missionary An Shigao, was political counsellor to the first Northern Wei emperor Tuoba Gui (370-409). Most importantly for Chinese art history, the Wei rulers converted to Buddhism and became great patrons of Buddhist arts. Numerous Central Asian objects have been found in Northern Wei tombs, such as the tomb of Feng Hetu. It is believed that the main influx of Western objects among the Northern Wei followed the defeat of the Rouran circa 450 CE, which allowed for the visit of diplomatic and, mainly, merchant caravans from Khotan, Kashmir and Sasanian Persia. Also, when the Northern Wei defeated the Northern Liang in 439 CE, they captured a great number of Sogdian merchants from their capital Wuwei, and resettled them in their own capital at Datong, thereby fostering trade.