Xuanwu was an avid Buddhist and often personally lectured on the Buddhist sutras. During his reign, Buddhism effectively became the state religion.
Tuoba Ke was born in 483, as the second son of Emperor Xiaowen. His mother was Xiaowen's concubine Consort, Gao Zhaorong. (As he was born the same year as his older brother Tuoba Xun, he was probably born just briefly after Tuoba Xun, whose mother was Consort Lin.) Little is known about his childhood, including whether he was raised by his mother Gao or not. In 496, Xiaowen changed the name of the imperial clan from Tuoba to Yuan, and thereafter he would be known as Yuan Ke.
In fall 496, Yuan Xun, who was then crown prince, but who could not endure the hot weather of the capital Luoyang after Xiaowen moved the capital there from Pingcheng (平城, in modern Datong, Shanxi) in 494, plotted to flee back to Pingcheng with his followers, but his plot was discovered. Xiaowen deposed him, and in 497 created Yuan Ke crown prince to replace Yuan Xun. (The creation was in Luoyang, but it is unclear whether prior to his creation, Yuan Xun was at Luoyang or Pingcheng.) Later that year, Gao, who was in Pingcheng, travelled south to rejoin her son in Luoyang, but she died on the way. Historians generally believe that she was murdered by Xiaowen's wife, Empress Feng Run, who wanted to raise Yuan Ke herself. Whether she was actually able to do so is unclear, but after she was discovered to have carried on an affair with her attendant Gao Pusa (高菩薩) in 499, she was put under house arrest, and Xiaowen ordered Yuan Ke to have no more contact with her.
Later in 499, Xiaowen, while on a campaign against rival Southern Qi, grew ill and died. Xiaowen's brother Yuan Xie the Prince of Pengcheng was put into command of the withdrawing army on an emergency basis, and Yuan Xie kept Xiaowen's death a secret while summoning Yuan Ke to join the army. Yuan Ke's attendants largely suspected Yuan Xie of wanting to take the throne himself, but Yuan Xie, once he met Yuan Ke, showed great deference to Yuan Ke, convincing Yuan Ke of his loyalty. Yuan Ke, at age 16, then took the throne as Xuanwu at Luyang (魯陽, in modern Pingdingshan, Henan), before the army could return to Luoyang.
Xuanwu initially wanted to make Yuan Xie, who was popular and well-regarded, prime minister, but Yuan Xie refused, and was made a provincial governor instead. The governmental affairs were largely in the hands of six officials: Xiaowen's brothers Yuan Xi (元禧) the Prince of Xianyang and Yuan Xiang (元詳) the Prince of Beihai, Xiaowen's cousin Yuan Cheng (元澄) the Prince of Rencheng, Xiaowen's distant uncle Yuan Jia (元嘉) the Prince of Guangyang, and the officials Wang Su (王肅) and Song Bian (宋弁), although Yuan Cheng was soon stripped of his post because he falsely arrested Wang on suspicion of treason. By 500, Xuanwu recalled Yuan Xie to be prime minister.
Xuanwu, once he returned to Luoyang, posthumously honored his mother Gao as an empress, and he created his maternal uncles Gao Zhao and Gao Xian (高顯), as well as his cousin Gao Meng (高猛), none of whom he had previously met, dukes. Gao Zhao, in particular, became increasingly powerful during Xuanwu's reign.
In 500, with Southern Qi in disarray because of the tyrannical rule of its emperor Xiao Baojuan, Northern Wei annexed the important city of Shouyang (壽陽, in modern Lu'an, Anhui) when the Southern Qi general Pei Shuye (裴叔業) surrendered the city to Northern Wei in fear of adverse actions by Xiao Baojuan. However, Northern Wei did not take further actions when Southern Qi was subsequently thrown into civil war during the rebellions of the generals Cui Huijing (崔慧景) and Xiao Yan.
In 501, the general Yu Lie (于烈) and Yuan Xiang warned Xuanwu that Yuan Xi was growing corrupt and Yuan Xie was growing too popular, and suggested that they be relieved of their posts. Xuanwu did so, and formally personally took over governmental matters, but at his age, he could not actually properly handle governmental affairs himself, so his trusted attendants and Gao Zhao began to become more powerful and corrupt. Traditional historians generally regard this as the starting point of Northern Wei's decline. Late in 501, Yuan Xi, displeased that his power wa being stripped and fearful that he would be killed, plotted a rebellion to secede with the provinces south of the Yellow River. His plot was discovered, however, and he was executed. From this point on, Xuanwu grew increasingly suspicious of members of the imperial clan.
Later in 501, Xuanwu created Yu Lie's niece, Consort Yu, empress.
Later that year, with Xiao Yan's forces crushing Xiao Baojuan's, Xuanwu's general Yuan Ying (元英) suggested that a major attack be launched against Southern Qi to take advantage of Southern Qi's civil war. However, Xuanwu only authorized small scale attacks, which were generally fruitless. Xiao Yan soon defeated Xiao Baojuan and by 502 had overthrown Southern Qi and established Liang Dynasty as its Emperor Wu. The Liang general Chen Bozhi (陳伯之) subsequently tried to surrender Jiang Province (江州, modern Jiangxi and Fujian) to Northern Wei, but Liang forces defeated both Chen and the Northern Wei forces sent to reinforce him, and Chen fled to Northern Wei. For the next few years, however, there would continually be war between the two rivals, particularly with Northern Wei creating Southern Qi's prince Xiao Baoyin, who fled Southern Qi as Xiao Yan was beginning to kill members of the Southern Qi imperial clan, as the Prince of Qi and announcing that it would help him reestablish Southern Qi.
In 504, Xuan Xiang, who had taken over Yuan Xi's posts, was accused by Gao Zhao of corruption. He was demoted to commoner rank, and died soon thereafter. At Gao's suggestion and despite Yuan Xie's opposition, Xuanwu subsequently put the imperial princes under heavy guard, effectively putting them under house arrest.
Meanwhile, the wars with Liang continued, and while both sides had gains and losses, Northern Wei made a substantial gain in 505 when the Liang general Xiaohou Daoqian (夏侯道遷) surrendered Nanzheng (南鄭, in modern Hanzhong, Shaanxi), as well as the surrounding region, to Northern Wei, which further annexed the semi-independent state Chouchi in spring 506. In winter 505, Liang launched a major counterattack on the eastern part of the border, commanded by Emperor Wu's brother Xiao Hong (蕭宏) the Prince of Linchuan, but with Xiao Hong being an incompetent general, who mishandled a night terror situation in summer 506, while his army was at Luokou (洛口, in modern Bengbu, Anhui), the Liang forces collapsed by themselves without engaging Northern Wei forces. Yuan Ying and Xiao Baoyin followed up by attacking the Liang fortress Zhongli (鍾離, in modern Chuzhou, Anhui), but were dealt a crushing defeat by the Liang general Wei Rui (韋叡) in spring 507. The two states largely stopped their military activities against each other after that point.
In winter 507, Empress Yu died suddenly, and in early 508, her young son Yuan Chang (元昌), Xuanwu's only son by that point, died suddenly as well. Because Gao Zhao was exceeding powerful by that point, and his niece Consort Gao was Xuanwu's favorite concubine, it was largely suspected that Gao Zhao and Gao murdered them, but there was no conclusive proof. In 508, Xuanwu created Gao as Empress to replace Yu, despite opposition by Yuan Xie, and from this point on Gao Zhao became resentful of Yuan Xie.
In fall 508, Xuanwu's younger brother Yuan Yu (元愉) the Prince of Jingzhao, who had just been demoted by Xuanwu for corruption, became angry at both his demotion and that his favorite consort Lady Li had been severely battered by Empress Yu briefly before Empress Yu's death (because Yuan Yu's wife was Empress Yu's sister but was unfavored by him), declared a rebellion at his provincial post of Xindu (信都, in modern Hengshui, Hebei) and proclaimed himself emperor. Gao Zhao used this opportunity to falsely accuse Yuan Xie of acting in concert with both Yuan Yu (because Yuan Yu had forced Yuan Xie's uncle Pan Senggu (潘僧固) into joining his rebellion) and Liang Dynasty. Xuanwu believed Gao, and forced Yuan Xie to commit suicide. The populace and the officials greatly mourned Yuan Xie's death, and grew increasingly resentful of Gao. Soon, Yuan Yu's rebellion was defeated, and while Xuanwu contemplated not putting Yuan Yu to death, Yuan Yu was killed on Gao's orders.
In 510, Xuanwu's concubine Consort Hu gave birth to a son, Yuan Xu. Because Xuanwu had lost multiple sons in childhood by that point, he carefully selected several experienced mothers to serve as Yuan Xu's wet nurses, and disallowed both Gao and Hu from seeing him. In winter 512, Xuanwu created Yuan Xu crown prince, and, abolishing the Northern Wei custom that the crown prince's mother must be forced to commit suicide, he did not force Hu to commit suicide.
During these years, Northern Wei and Liang continued to have relatively minor border battles, with each side having gains and losses. In 514, however, Xuanwu commissioned Gao Zhao to launch a major attack against Liang's Yi Province (益州, modern Sichuan and Chongqing). Soon thereafter, however, in spring 515, he died suddenly, and Yuan Xu succeeded him (as Emperor Xiaoming). Yuan Cheng, Xuanwu's brother Yuan Yong the Prince of Gaoyang, and Yu Lie's son Yu Zhong seized power and, after recalling Gao, put him to death, and Gao was removed. Xiaoming's mother Hu became empress dowager and regent.
Xuanwu was buried north of Luoyang. His tomb is now open to the public as part of the Luoyang Ancient Tombs Museum.Jingming (景明 Jǐngmíng) 500–503
Zhengshi (正始 Zhèngshǐ) 504–508
Yongping (永平 Yǒngpíng) 508–512
Yanchang (延昌 Yánchāng) 512–515
Emperor Xiaowen of Northern Wei
Consort Gao Zhaorong(高照容)(d. 497), posthumously honored as Empress Wenzhao
Empress Yu (created 501, d. 507), mother of Prince Chang
Empress Gao Ying (高英)(created 508, d. 518), mother of Princess Jiande and an unnamed son
Consort Hu, mother of Crown Prince Xu
Yuan Chang (元昌) (b. 506, d. 508)
Yuan Xu (元詡), the Crown Prince (created 512), later Emperor Xiaoming of Northern Wei
Unnamed son, died early
Princess Ming Lian (Yongtai)