During Xuanwu's reign, Northern Wei appeared, outwardly, to be at its prime, but there was much political infighting and corruption, particularly by Xuanwu's uncle Gao Zhao.
Xuanwu was an avid Buddhist, and during his reign Buddhism effectively became the state religion, as Xuanwu himself often personally lectured on the Buddhist sutras.
Tuoba Ke was born in 483, as the second son of . His mother was Xiaowen's concubine Consort Gao. 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 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. 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 , 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 wom 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 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 .
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 growingly 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, , 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 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 , 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 , the Liang forces collapsed by themselves without engaging Northern Wei forces. Yuan Ying and Xiao Baoyin followed up by attacking the Liang fortress Zhongli , 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 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 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 , declared a rebellion at his provincial post of Xindu and proclaimed himself emperor. Gao Zhao used this opportunity to falsely accuse Yuan Xie of acting in concert with both Yuan Yu 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 gave birth to a son, . 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 . Soon thereafter, however, in spring 515, he died suddenly, and Yuan Xu succeeded him . 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'' 500-503
* ''Zhengshi'' 504-508
* ''Yongping'' 508-512
* ''Yanchang'' 512-515
** Emperor Xiaowen of Northern Wei
** Consort Gao , posthumously honored as Empress Wenzhao
** , mother of Prince Chang
** , mother of Princess Jiande and an unnamed son
* Major Concubines
** , mother of Crown Prince Xu
** Yuan Chang
** Yuan Xu , the Crown Prince , later Emperor Xiaoming of Northern Wei
** Unnamed son, died early
** Princess Taiyuan
** Princess Jiande
** Princess Yangping