三藩之乱
In the 14th century, Kunming was retaken from Khan Mongolian control when the Ming dynasty defeated the Yuan Dynasty, later building a wall surrounding present-day Kunming. 300 years later, Ming General Wu Sangui defected to Manchu invaders and held the city until his death in 1678, long after the rest of China had fallen under Manchu rule. During the beginning of Qing rule, the entirety of Yunnan and Guizhou were ruled from Kunming and Wu. During the Revolt of the Three Feudatories, the seat of Wu's newly declared Zhou dynasty was moved to Hengzhou, Hunan. Later in 1678 when Wu died, his grandson Wu Shifan resisted the Qing for two more months before committing suicide, thereby reverting control of the city back into Qing hands. During the Ming and Qing dynasties, it was the seat of the superior prefecture of Yunnan.