The Gorkhas, a martial tribe came to power in Nepal in the year 1768. They consolidated their military power and began to expand their territory. Gradually the Gorkhas annexed Sirmour and Shimla hill states. With the leadership of Amar Singh Thapa, Gorkhas laid siege to Kangra. They managed to defeat Sansar Chand, the ruler of kangra, in 1806 with the help of many hill chiefs. However Gorkhas could not capture Kangra fort which came under Maharaja Ranjeet Singh in 1809. After this defeat the Gorkhas began to expand towards south. This resulted in the Anglo-Gorkha war. They came into direct conflict with the English along the tarai belt after which the English expelled them from the hill states east of the Satluj. Thus British slowly emerged as the paramount powers in this tract.
After the Anglo-Gorkha war the common border of the British domain and Punjab became very sensitive. Both the Sikh and English wanted to avoid a direct conflict, but after the death of Ranjit Singh, the Khalsa army fought a number of wars with the British. In 1845 when the Sikhs invaded the British territory by crossing the Satluj, the rulers of many hill states sided with the English as they were looking for an opportunity to settle scores with the former. Many of these rulers entered into secret communication with the English. After the first Anglo-Sikh war, the British did not restore the hill territory vacated by Sikhs to their original owners.