In 885, Li Changfu became involved in a power struggle that initially started as a confrontation between the powerful eunuch Tian Lingzi and Wang Chongrong the military governor of Huguo Circuit (護國, headquartered in modern Yuncheng, Shanxi), over control of salt ponds at Huguo Circuit. Tian tried to remove Wang Chongrong from the scene by having Emperor Xizong issuing an edict transferring him to Taining Circuit (泰寧, headquartered in modern Jining, Shandong), Qi Kerang the military governor of Taining to Yiwu Circuit (義武, headquartered in modern Baoding, Hebei), and Wang Chucun the military governor of Yiwu to Huguo. Wang Chongrong refused the order and prepared for confrontation with Tian, along with his ally Li Keyong the military governor of Hedong Circuit (河東, headquartered in modern Taiyuan, Shanxi), while Tian allied with Li Changfu and Zhu Mei the military governor of Jingnan Circuit (靜難, headquartered in modern Xianyang, Shaanxi). Around the new year, Li Keyong's and Wang Chongrong's troops engaged Tian's, Li Changfu's, and Zhu's troops at Shawan (沙苑, in modern Weinan, Shaanxi) and defeated them. As Li Keyong then approached the capital Chang'an, Tian took Emperor Xizong and fled to Fengxiang, and then to Xingyuan (興元, in modern Hanzhong, Shaanxi).[3]
Meanwhile, Zhu and Li Changfu became embarrassed about their own alliance with Tian, and decided to instead support a new emperor who was not influenced by Tian. At that time, Zhu had, under his control, Emperor Xizong's distant relative Li Yun the Prince of Xiang. Under agreement with Li Changfu, he took Li Yun back to Chang'an and initially declared Li Yun regent and then emperor. They also sent troops to try to capture Emperor Xizong at Xingyuan, but they were repelled. However, after Zhu thereafter had himself made a chancellor and was showing that he was controlling Li Yun's court by himself, Li Changfu, in anger, refused all titles bestowed by Li Yun, instead submitting a petition to Emperor Xizong at Xingyuan to pledge his loyalty. Emperor Xizong thus bestowed on Li Changfu the honorary title of acting Situ (司徒, one of the Three Excellencies).[3]