The British were upset about the local rulers' stance during the First Anglo-Afghan War (1839–42). After Napier first gained military control of the region by forcing an agreement with the Sindh amirs, his forces attacked the fortress at Imamgarh. After the attack on Imamgarh a popular revolt broke out against the British by the people of Sindh