There cannot be any second about the need of discretionary powers in the hands of military to handle unforeseen developments, particularly in India which boasts enormous recipes for conflicts and unrests.
But the problem is keeping the military entirely out of the ambit of any regulatory or supervising authority. When it was enacted in 1958, it was meant to assist the military in dealing with armed rebellions in many regions of the country. But later the law assumed ominous proportions and misused by armed forces to create utter Human rights violations and chaos. For example, in pathribal case, the supremacy of the law came to be known by wide public after the Supreme Court ordered the army to court-martial them. But, unsurprisingly, army declared insufficient evidence and released them.