After the Treaty of Salbai was concluded in 1782 between the British and Maharaja Mahadji Sindhia of Gwalior, David Anderson, who contributed to drafting the treaty, was appointed resident at the Gwalior court. The court was a moving camp until 1810, when Mahadji's successor Daulat Rao Sindhia permanently fixed his headquarters near the fortress of Gwalior, on the spot where Lashkar city now stands. Daulat Rao Sindhia was forced to sign a treaty of subsidiary alliance with the government of British India in 1817 at the conclusion of the Third Anglo-Maratha War. The Resident at Gwalior answered directly to the Governor-General of India until 1854, when Gwalior Residency was placed under the authority of the Central India Agency. The fortress of Gwalior was captured by rebels during the Indian Rebellion of 1857, and recaptured by British troops in 1858, who occupied the fortress until 1886. In 1860 the smaller states were made into a separate charge, under the officer commanding the Central India Horse at Guna. This arrangement was abolished in 1896, when these states were again placed under the resident, with the officer commanding at Guna continuing to act as "ex officio" assistant to the Resident, with very limited powers. In 1888 Khaniadhana state was transferred from the Bundelkhand Agency to the Resident at Gwalior, and in 1895 the Gwalior State districts of Bhilsa and Isagarh were transferred from Bhopal Agency to the Gwalior Residency. In 1921 Gwalior Residency was separated from the Central India Agency, and the resident again answered directly to the Governor-General. In 1936 the princely states of Benares and Rampur, which had previously been under the authority of the United Provinces, were placed under the authority of the Gwalior resident.