Zuo Zongtang's recovery of Xinjiang was the war of 1876-1878 (the second to fourth years of Guangxu) in which the Qing armies destroyed Yaqub Beg's state and restored the far northwest. In 1865 the Kokandi officer Yaqub Beg had ridden the Muslim risings into Xinjiang and set up his 'kingdom of Jette Shahr'; Russia held Ili from 1871 and Britain opened recognition — the frontier in peril. In the 1875 debate between sea defense and frontier defense, Zuo Zongtang argued 'the sea in the east, the frontier in the west — both weigh the same', and took the commission for Xinjiang. He rebuilt the army at Lanzhou first: an arsenal casting its own ordnance, colonies storing grain, western rifles bought in; in 1876 he marched on the plan 'north first, south later; slow to advance, swift to strike' — Liu Jintang led the columns through the passes and retook Urumqi and Manas in the same year, fixing most of the north; in 1877 the armies drove south through Daban Cheng and Toksun, Yaqub Beg died suddenly, his state dissolved, and by year's end the cities of the southern Tianshan were recovered; by January 1878 all Xinjiang but Ili was back, and Ili's bulk followed by the treaty negotiation of 1881. In 1884 Xinjiang became a province, Liu Jintang its first governor, the commandery-county system running north and south of the Tianshan. It was the rare large-scale recovery of lost ground in modern Chinese history — the Qing's northwest preserved by it — and Zuo Zongtang's march with his coffin carried has passed into legend.