The Mughal emperor, Aurangzeb's expeditions in Deccan in 1890s, had put considerable strain on the Mughal exchequer. As a result, Aurangazeb issued orders to recover annual tributes from the rulers of Shivalik hills, who had been defaulting on the payment. Alif Khan was given the responsibility of recovering dues from Kangra and adjoining principalities.
The Raja of Kangra and another chieftain called Raja Dayal yielded to the demands of Alif Khan. However, Raja Bhim Chand of Kahlur (Bilaspur) refused to oblige and formed an alliance with other chieftains opposed to the Mughals. Guru Gobind Singh also decided to support Bhim Chand.
Alif Khan's Mughal army and his aides were defeated at a battle in Nadaun. The date of the battle is given differently by different authors, as 1687, 1689, 1690, 20 March 1691, and 4 April 1891.
After the battle ended, Guru Gobind Singh stayed in Nadaun for eight days, before returning to Anandpur. Later, Maharaja Ranjit Singh built a gurdwara on the spot where the Guru had pitched his tent. The Gurdwara was affiliated to Shiromani Gurdwara Prabandhak Committee in 1935.