The origins of the Viceroy of Sichuan trace back to 1644, during the reign of the Shunzhi Emperor, with the creation of the office of the Provincial Governor of Sichuan. Its headquarters were in Chengdu. In 1645, the Qing government created the Viceroy of Huguang-Sichuan with Luo Xiujin as the first Viceroy overseeing both Huguang and Sichuan provinces. In 1653, Sichuan was placed under the jurisdiction of the Viceroy of the Three Borders in Shaanxi, which was subsequently renamed "Viceroy of Chuan and the Three Borders in Shaanxi" with Meng Qiaofang as the officeholder. In 1656, the office was divided into two separate Viceroys for Shaanxi and Sichuan. The Viceroy of Sichuan was based in Chongqing. In 1661, the Viceroy of Sichuan relocated its headquarters to Hanzhong. In 1668, during the reign of the Kangxi Emperor, the Viceroy of Huguang was abolished and merged into the Viceroy of Sichuan, which was then renamed "Viceroy of Chuan-Hu" and based in Jingzhou. In 1670, the Viceroy of Chuan-Hu relocated to Chongqing. Four years later, perhaps coinciding with the Revolt of the Three Feudatories, the Viceroy of Chuan-Hu reverted to pre-1668, separating into the Viceroy of Huguang and Viceroy of Sichuan. In 1680, the Kangxi Emperor merged the Viceroy of Sichuan with the Viceroy of Shaanxi under the "Viceroy of Chuan-Shaan", with its headquarters in Xi'an. In 1718, a separate Viceroy was created for Sichuan, so the Viceroy of Chuan-Shaan stopped managing Sichuan. However, these changes were reversed in 1721. In 1731, the Yongzheng Emperor split the Viceroy of Chuan-Shaan into the Viceroy of Sichuan and Viceroy of Shaan-Gan, with the latter headquartered in Chengdu. In 1736, the Qianlong Emperor abolished the Viceroy of Sichuan and recreated the office of Viceroy of Chuan-Shaan. In 1748, during the campaign against the Jinchuan hill peoples in Sichuan, the Qianlong Emperor split the Viceroy of Chuan-Shaan into the Viceroy of Sichuan and Viceroy of Shaan-Gan. He merged the two Viceroys in 1759 but reversed the changes in the following year. The system had remained as such until the end of the Qing dynasty.