During the rule of the Qing dynasty, the governor was a viceroy of the Qing Emperor, but the local ethnic groups enjoyed much autonomy. Many chiefs retained their traditional authority, participating in local administrations. The Dungan revolt (1862–77) devastated the Hui Muslim population of Shaanxi, shifting the Hui center of population to Gansu and Qinghai. Another Dungan revolt broke out in Qinghai in 1895 when various Muslim ethnic groups in Qinghai and Gansu rebelled against the Qing. Following the overthrow of the Qing dynasty in 1911, the region came under Chinese Muslim warlord Ma Qi control until the Northern Expedition by the Republic of China consolidated central control in 1928.