An Israeli invasion of Gaza will face an enemy that has built a formidable armory with Iran's help, dug a vast tunnel network to evade attackers and has shown in past ground wars it can exact a heavier toll on Israeli troops in each conflict.

As Israel masses tanks on Gaza's border and ministers suggest the start of an invasion is a matter of when not if, Israel's generals will look to lessons learned from past ground offensives in 2008 and 2014 that also aimed to smash the Palestinian Islamist group Hamas, an Israeli security source and experts said.

Hamas has emerged as a more formidable opponent with each clash with Israeli forces, and on Oct. 7 it staged its most devastating display when its fighters killed more than 1,300 Israelis — most of them civilians — in the deadliest attack on Israeli soil since its founding in 1948.