Incident comes as Israel says it will ban Jewish visitors from Al-Aqsa for the rest of Ramadan.
“I commend the actions of the soldiers who eliminated two terrorists who opened fire on them near Elon Moreh [near the West Bank city of Nablus],” Gallant said on Twitter on Tuesday.
“Their successful operation prevented an attack against Israeli citizens,” Gallant later said in a statement. Earlier, the military had said its forces “neutralised” two men and found rifles and handguns at the scene.
Local Palestinian sources from Nablus told Al Jazeera that the bodies of the two men – identified as Mohammed Abu Dhraa and Soud al-Titi – were taken by the Israeli military.
Al-Titi was a member of the Palestinian Authority security forces, while Abu Dhraa was a former detainee who spent seven years in an Israeli prison, the sources said.
Israel has been withholding the bodies of Palestinians as a punitive policy for decades. However, human rights groups have said that there has been a significant rise in this practice since 2015.
According to the Jerusalem Legal Aid and Human Rights Center, Israel currently withholds at least 105 Palestinian bodies at morgues, an act it calls collective punishment of families who often cannot obtain closure without a burial.
During the past year, the Israeli army has carried out frequent raids across the occupied West Bank.
Under the most far-right government in Israel’s history, sworn in late last year, the raids have escalated, taking a heavy toll on civilians.
More than 90 Palestinians have been killed and at least 19 Israelis and foreigners have died since January.
Tensions are running especially high as the Muslim holy month of Ramadan and the Jewish Passover coincide.
Several Israeli police raids on the Al-Aqsa Mosque compound in Jerusalem last week and attacks on Palestinian worshippers triggered rocket attacks on Israel that met Israeli attacks in Gaza, southern Lebanon and Syria.
On Tuesday, Israel said it would be banning Jewish visitors and tourists from the Al-Aqsa Mosque compound until the end of Ramadan, a statement from Prime Minister Benjamin Netanyahu’s office said.
In previous years, Israel has also banned Jewish visits to the compound during the last 10 days of Ramadan.
Last week, suspected Palestinian gunmen killed three settlers and a ramming attack hours later killed an Italian tourist. No groups claimed responsibility for either attack.
On Monday, Palestinian mourners gathered for the funeral of a 15-year-old boy shot dead by Israeli forces during a raid in the Aqabat Jaber refugee camp, near Jericho in the Jordan Valley.
The Palestinian health ministry said Mohammad Balhan sustained gunshot wounds to his head, chest and abdomen.
The Palestinian Prisoners Association said the Israeli military arrested at least two people during the raid.
“We urge the world to hold this [Israeli] government accountable for its crimes,” Palestinian Prime Minister Mohammad Shtayyeh said at the start of the weekly government session.