Gaza Hamas IDF Israel
Israeli machines (top L) work on destroying a tunnel, as Israeli soldiers return to Israel from Gaza (seen in the background). Reuters

Twenty-three militants from Hamas' military wing have been rescued from a tunnel dug into Israel after being trapped for two weeks following an Israel Defence Forces (IDF) air strike.

"The 23 fighters had survived almost certain death when a tunnel collapsed at the beginning of the Israeli ground assault," Qassam Brigades said in a statement.

The statement confirmed that the militants were in the tunnel preparing for an attack against IDF troops when the attack occurred.

"We lost contacts with our colleagues," said a rescued Hamas fighter.

A trapped Hamas commander said that the fighters were discovered during a three-day ceasefire between Israel and the group.

"Rescue teams dug the area to extract the mujahideen [fighters] and they were surprised to find us alive," he was quoted as saying by the Anadolu Agency.

The discovery comes as Israel removes all of its ground troops from the territory and both parties hold indirect talks in Cairo regarding a lasting ceasefire agreement.

Israel has offered to extend the current three-day ceasefire, while Hamas says that it will not accept an extension unless the Israeli blockade is lifted.

US President Barack Obama said that risks need to be taken on both sides to bring about a more durable truce.

"Long term, there has to be a recognition that Gaza cannot sustain itself permanently closed off from the world," he said in Washington.

According to Palestinian officials, the death toll in Gaza has risen to 1,886 with 9,806 injured. The Israeli military has confirmed that 61 IDF soldiers were killed in their operation as well as two Israeli civilians and a Thai national.