The Doon Valley lies between the outer Himalaya and the low Shivalik range, watered by the Ganga to the east and the Yamuna to the west. Its name is linked by tradition to Guru Ram Rai, son of the seventh Sikh Guru, who settled here in the late 17th century; his Darbar Sahib in the city centre, built in a mix of Mughal and Indian styles, is still the heart of the old town and of the yearly Jhanda Mela.
The valley was ruled by the Garhwal kings, then briefly by the Gorkhas, before it passed to the British after the Anglo-Nepalese War of 1814–16. The British made Dehradun a base for surveying the Himalaya — the Survey of India still has its headquarters here — and founded the Imperial Forest Research Institute (1906), the Indian Military Academy (1932) and boarding schools such as the Doon School (1935).
When Uttarakhand was carved out of Uttar Pradesh in 2000, Dehradun became its capital. It has grown fast since, but the green campuses, the clock tower and the bazaars of the old town remain.