16th century. His descendants defended against the rising power of the Kumaon kingdom, which was encroaching on Garhwal's eastern boundaries, but Uttarkashi was not affected. Mahipati Shah was the first Garhwal Raja to fully control the entirety of Kumaon, including all of Uttarkashi, from his capital at Srinagar in around 1580. The Garhwal Rajas, although not directly controlled by the Mughals, still had to pay tribute. The historian Firishta records Garhwal (modern scholars believe he confused it with Kumaon) was a wealthy and powerful mountain kingdom that produced significant amounts of copper and gold, both metals mined from ancient times in Uttarkashi district. In 1635, a famine struck Garhwal and the year after, a Mughal force invaded the region. However the raja soon starved out the Mughals and forced them to retreat, while another Mughal expedition in 1654 aided by the raja of Kumaon failed also. After Dara Shukoh's defeat in 1658, his son Sulaiman took refuge for a year with the Garhwal raja Prithvi Shah. However threat of invasion from Aurangzeb and the Kumaon rajas, as well as pressure from many in his court forced Shah to give up Sulaiman to Aurangzeb. Uttarkashi remained relatively uninfluenced by the subsequent border wars between Kumaon and Garhwal. Garhwal and Kumaon fought against the Rohillas in 1745, but were defeated and Garhwal was forced to pay 3 lakhs as tribute. After this, Garhwal was devastated by a Rohilla invasion in 1757. Modern era Gorkha invasion In 1795, Gorkha troops temporarily overran Garhwal, including the entirety of Uttarkashi district, having earlier occupied Kumaon five years earlier. However news of a Chinese invasion of Nepal caused the Nepalis to retreat from Garhwal. The Garhwal ruler Pradyuman Shah agreed to pay a tribute to the Gorkha rulers and send an agent to Kathmandu, an arrangement that lasted for 12 years. In the beginning of 1803, Uttarkashi in particular was devastated by an earthquake. The next year Gorkha generals including Amar Singh Thapa led a second invasion against Garhwal. The Garhwal raja, Pradyuma Shah, retreated via Uttarkashi to Dehradun, where he was defeated in the Battle of Khurbura and killed. His sons fled to British territory, and Amar Singh Thapa was made governor of Garhwal in 1805. Gorkha rule is remembered as a dark time with widespread looting, rape and violence. British invasion In 1814, the Anglo-Nepalese War broke out and the British invaded Garhwal through