Solution:In (1803-1804), Gorkha invaded Garhwal region when King Pradumn Shah was the ruler. King Pradumn Shah was killed in the battle in Dehra Dun but his only son (Sudarshan Shah was minor at that time) was cleverly saved by the trusted courtiers.With the victory of Gorkhas in this battle their dominion was established in Garhwal region. Later on their kingdom extended up to Kangara and they ruled over this region continuously for 12 years before they were thrown away from Kangara by Maharaja Ranjit Singh.
On the other hand Sudarshan Shah could manage help from East India Company and got his kingdom freed from Gorkha rulers.
The East India Company merged Kumaon, Dehra Dun and east Garhwal in the British Empire and the west Garhwal was given to Sudarshan Shah which was then known as Tehri Riyasat.