The deaths were announced as Israel said its forces had encircled southern Gaza's main city Khan Younis in a major ground assault, trapping Palestinians trying to flee.

An Israeli military spokesman said the soldiers died on Monday (January 22) when two buildings they had mined for demolition exploded, after Hamas militants fired at a nearby tank.

Earlier, three soldiers were reported killed in a separate attack in southern Gaza.

As mourners attended the funeral of one of the slain servicemen, Israeli Prime Minister Benjamin Netanyahu vowed that Israel would not stop fighting in Gaza until it achieved "absolute victory."

In Jerusalem, some Israelis spoke of the military losses as a necessary sacrifice.

"Well, that's horrible, that's horrendous, it's terrible. You know, it's our sons, it's our brothers, it's terrible, but what we got to do we got to do, so that October 7 doesn't happen again."

Israel says it is attacking remaining Hamas strongholds in Gaza and trying to clear areas near the border.

It launched its assault after Hamas fighters attacked Israeli towns on October 7, killing 1,200 people and capturing some 250 hostages.

Since then, nearly all Gaza's 2.3 million people have lost their homes.

Gaza's health authorities say at least 195 Palestinians were killed in the previous 24 hours, adding to an overall death toll of more than 25,000.

They fear thousands more may be lost in the rubble.

Gazans say Israeli forces have blockaded and stormed hospitals, leaving the wounded and dead beyond the reach of rescuers.

"What happened was that we went to check on our homes and our area in Khan Younis, when we found the martyrs scattered around, may God help them. Seeing them gives one chills. No matter how hard it was, we would have brought them, even if there was an aircraft above us wanting to target us."

Although the war still has overwhelming public support in Israel, discontent is emerging over Netanyahu's strategy: the total annihilation of Hamas, but with only vague discussion of what should follow.

Hamas has controlled Gaza since 2007 and refuses to recognize Israel.

Netanyahu has vowed never to allow an independent Palestinian state, which runs counter to the decades-old Middle East policy of Israel's main ally, Washington.

The conflict has been accompanied by unrest elsewhere in the Middle East, including in Lebanon, Iraq, Syria, Yemen and the Red Sea.