(宣武, headquartered in modern Kaifeng, Henan) repairing the palace at Luoyang and repeatedly requesting Emperor Zhaozong to move the capital there, he and Han Jian decided to have their soldiers jointly repair the palace and the imperial offices at Chang'an to beg Emperor Zhaozong for forgiveness. Emperor Zhaozong, in response, issued an edict ending the campaign against Li Maozhen in spring 898 and restoring his imperially-bestowed name of Li Maozhen and his title as military governor of Fengxiang, and later in the year making him additionally the military governor of Zhangyi. Emperor Zhaozong subsequently returned to Chang'an. In 900, there was an incident where Emperor Zhaozong, after becoming drunk, personally killed a few eunuchs and ladies in waiting. The eunuch commanders of the imperial Shence Army, Liu Jishu and Wang Zhongxian (), as well as the eunuch directors of palace communications Wang Yanfan () and Xue Qiwo (), jointly deposed him and declared his son Li Yu, Prince of De the Crown Prince the new emperor. However, in 901, the Shence Army officers Sun Dezhao (), Zhou Chenghui (), and Dong Yanbi () carried out a countercoup, killing the four top eunuchs and restoring Emperor Zhaozong to the throne. After this incident, Li Maozhen went to Chang'an to pay homage to Emperor Zhaozong. Emperor Zhaozong thereafter bestowed the titles of acting Shangshu Ling and Shizhong on him, and also created him the Prince of Qi. At the request of the chancellor Cui Yin, who was fearful that surviving eunuchs would make a comeback, Li Maozhen left 3,000 Fengxiang soldiers at Chang'an to counteract the Shence Army, which remained under the command of eunuchs Han Quanhui and Zhang Yanhong () (who was formerly the eunuch monitor of the Fengxiang army). Meanwhile, when Zhu attacked Huguo Circuit around the same time, and Wang Ke sought aid from both Li Keyong and Li Maozhen, Li Keyong was unable to save him because his path was cut off by another army of Zhu's, and Li Maozhen did not act at all. Zhu was able to force Wang Ke to surrender, adding Huguo to the territory he controlled. Meanwhile, to reduce the financial independence of the Shence Army, Cui issued an order that the Shence Army, along with the nearby circuits, no longer be given monopolies on the sale of yeast. Li Maozhen, however, was unwilling to give up the yeast monopoly, and requested to