安帝
In 403, Huan Xuan forced Emperor An to yield the throne to him, temporarily ending Jin. Huan Xuan established a new state of Chu, and he created Emperor An the Prince of Pinggu and Sima Dewen the Duke of Shiyang, but kept them close to him to watch them. In 404, however, a rebellion by the general Liu Yu quickly led to Huan Xuan's destruction and Emperor An's restoration. When, however, later that year Emperor An and Sima Dewen fell into the hands of Huan Xuan's nephew Huan Zhen (), Huan Zhen considered executing Emperor An to avenge Huan Xuan's young son Huan Sheng (), who was killed by the rebels. It took great pleading on Sima Dewen's part, explaining that neither he nor Emperor An had had anything to do with Huan Sheng's death, for Huan Zhen to spare Emperor An. In early 405, Huan Zhen was defeated, and Emperor An and Sima Dewen returned to the capital Jiankang, but by this point power was in Liu Yu's hands, albeit in a power-sharing agreement with a number of allies whom he had had to recruit in his campaign against Huan Xuan.