In 1835, Dost Mohammad Khan, the youngest and the most energetic of the Barakzai brothers, who had supplanted the Durrani dynasty and become Emir (lord, chief or king) of Kabul in 1825, advanced up to Khaibar Pass threatening to recover Peshawar. In 1836 Hari Singh Nalva, the Sikh general who along with Prince Nau Nihal Singh was guarding that frontier, built a chain of forts, including one at Jamrud at the eastern end of the Khyber Pass to defend the pass. Dost Muhammad erected a fort at `Ali Masjid at the other end. In the beginning of 1837, as Prince Nau Nihal Singh returned to Lahore to get married and the Maharaja and his court got busy with preparations for the wedding.