two military crises. Tang and Nanzhao had gotten into a diplomatic row over the name of the Nanzhao king Qiulong ()—as it violated naming taboo for Emperor Yizong's ancestor Emperor Xuanzong (Li Longji). Emperor Yizong thus refused to issue an edict formally bestowing Qiulong his kingly title. Qiulong responded by changing his state's name to Dali and declaring himself emperor (thus positioning himself as an equal to Emperor Yizong) and by attacking a number of Tang outposts. Meanwhile, the agrarian rebel Qiu Fu () and his followers were overrunning Zhedong Circuit (浙東, headquartered in modern Shaoxing, Zhejiang). Qiu's rebellion was suppressed by the imperial general Wang Shi in 860, but the Dali attacks would become more intense, and Dali briefly captured the important city Yong Prefecture (邕州, in modern Nanning, Guangxi) in 861 and then captured Jiao Prefecture (交州, in modern Hanoi, Vietnam) in 862, retaining it. Despite these crises, Emperor Yizong was said to be spending much of his time in feast and games, ignoring the affairs of state, despite his officials' urging to attend to them, although he was sending generals to the Dali front (including Kang Chengxun and Gao Pian), without initial success. Middle reign Over the course of 865–866, however, Gao Pian was able to defeat Dali forces and recapture Jiao Prefecture. Meanwhile, though, the tense situation on the Dali border at Xichuan Circuit (西川, headquartered in modern Chengdu, Sichuan) led to a major misstep on the part of Emperor Yizong, as he was misled by the official Li Shiwang () into carving out seven border prefectures out of Xichuan into a new Dingbian Circuit (定邊, headquartered at Xi Prefecture (), in modern Chengdu) and commissioning Li Shiwang as its military governor despite the obvious impractical nature of Dingbian's territory—as Xi Prefecture was extremely close to Xichuan's capital Chengdu Municipality and unsuitable to serve as the capital for a circuit intended to concentrate on border defense. The Dingbian debacle demoralized the officers at Xichuan, who went as far as secretly encouraging Dali to attack Dingbian to expose Li Shiwang. Yet more disastrous, though, was a mutiny by soldiers for Xusi Circuit (徐泗, headquartered in modern Xuzhou, Jiangsu), who had been posted to Gui Prefecture (桂州, in modern Guilin, Guangxi) to defend against a potential Dali attack, with a promise that they would be allowed to return home after three years. When the term was up in