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.