Shimla, along with Almora, Kumaon, Garhwal, Sirmaur, Dehradun and Kangra, was invaded and captured by Prithvi Narayan Shah of Nepal. Shortly later, the British East India Company with local kings went to war with Nepal from 1814 to 1816. At the conclusion of the war, as a result of the Sugauli Treaty, all these captured parts of North India were ceded to the British East India company. At that time, Shimla was known for the temple of Hindu Goddess Shyamala Devi, and not as a city as it is today.
Not long after gaining possession of Shimla, the British began to develop the area. The Scottish civil servant Charles Pratt Kennedy built the first British summer home in the town in 1822. Lord Amherst, the Governor-General of Bengal from 1823 to 1828, set up a summer camp here in 1827, when there was only one cottage in the town, and only 'half a dozen' when he left that year. There were more than a hundred cottages within ten years. Shimla soon caught the eye of Lord William Bentinck, the next Governor-General of Bengal from 1828 (later of India, when the title was created in 1833) to 1835. In a letter to Colonel Churchill in 1832, he wrote
One of his successors, Sir John Lawrence (Viceroy of India 1864–1869), decided to take the trouble of moving the administration twice a year between Calcutta and this separate centre over 1,000 miles away, despite the fact that it was difficult to reach. Lord Lytton (Viceroy of India 1876-1880) made efforts to plan the town from 1876, when he first stayed in a rented house, but began plans for a Viceregal Lodge, later built on Observatory Hill. A fire cleared much of the area where the native Indian population lived (the "Upper Bazaar"), and the planning of the eastern end to become the centre of the European town forced these to live in the Middle and Lower Bazaars on the lower terraces descending the steep slopes from the Ridge. The Upper Bazaar was cleared for