Armed Forces are deployed in counter-insurgency / terrorist operations when all other forces available to the State have failed to bring the situation under control. Armed forces operating in such an environment require certain special powers and protection in the form of an enabling law. https://warriorsdefenceacademy.com/afspa-all-you-need-to-know