In 1814, the Anglo-Nepalese War broke out and the British invaded Garhwal through Dehradun but were repulsed multiple times. However, after the war's end and the subsequent Treaty of Sugauli, the Gorkhas relinquished all territory west of the Kali river, including Garhwal and Uttarkashi district. Garhwal west of the Alaknanda, excluding Dehradun and all of Uttarkashi, was returned to the Garhwal rajas, who subsequently imposed violent retaliation on the remaining Gorkhas. Uttarkashi at this time was regarded as rocky and barren. In subsequent negotiations, Rawain tehsil, modern Uttarkashi, was returned to the Garhwal raja.