The Israeli military says it has recovered the bodies of five Palestinian militants killed after it destroyed a tunnel leading from Gaza into Israeli territory.

Israel detonated the tunnel inside its territory last week in a rare flare-up along the tense border that has remained largely quiet since a 2014 war between Israel and Hamas.

The military says Sunday that it was completing the "uncovering and destruction" of the tunnel when it found the bodies. The Islamic Jihad, an Iran-backed militant group in Gaza, has said the five were its members. The group has vowed revenge.

Seven other militants, including two members of the Islamic militant Hamas group that rules Gaza, suffocated to death in the tunnel while trying to rescue the five militants.