JERUSALEM — The Israeli military has canceled a contentious directive known as the Hannibal procedure, which calls for the use of maximum force to prevent the capture of Israeli soldiers, even at the risk of harming them.

A military official, speaking on the condition of anonymity in accordance with army rules, said on Tuesday that the chief of staff, Lt. Gen. Gadi Eisenkot, had given instructions several weeks ago to revoke the decades-old directive. The official said the chief of staff had established a team to formulate a new procedure for such situations.

The Hannibal procedure was last invoked, with devastating consequences, during the war in Gaza in 2014. Palestinian militants ambushed Israeli soldiers soon after a truce took effect on the outskirts of Rafah, in southern Gaza, and dragged one of them, Second Lt. Hadar Goldin, into a tunnel.

At least 135 Palestinians were said to have been killed as Israeli forces unleashed a barrage of artillery and airstrikes meant to prevent the militants from taking Lieutenant Goldin deeper into the Gaza Strip. The episode became a focus of international scrutiny and condemnation. Amnesty International said there was strong evidence that Israel had carried out war crimes by bombarding residential areas of Rafah.