JERUSALEM (Reuters) - Israel's security cabinet approved extending the humanitarian ceasefire begun early on Saturday until midnight local time (1700 EST) on Sunday, an Israeli government official said.

"At the request of the United Nations, the cabinet has approved a humanitarian hiatus until tomorrow (Sunday) at 24:00. The IDF (Israel Defence Forces) will act against any breach of the ceasefire," the official, who was not named, said in a statement.

Late on Saturday, militants ignored an Israeli announcement that it would extend the truce by four hours and resumed firing rockets into Israel from Gaza around two hours after the end of the initial 12-hour ceasefire period. It began at 8 a.m. (0100 EST) on Saturday.

After the ceasefire began early on Saturday, Gazans took advantage of the lull in fighting to retrieve their dead and stock up on food, flooding into the streets to discover scenes of massive destruction in some areas.

At least 1,033 Palestinians, mostly civilians, have been killed in the fighting since July 8 when Israel launched its offensive, aimed at ending rocket fire by Islamist militants out of Gaza.

Israel said five more of its soldiers were killed in pre-truce fighting in Gaza and two others died of their wounds in hospital, bringing the army death toll to 42 as troops battled militants in the tiny Mediterranean enclave that is home to 1.8 million Palestinians.

Three civilians, including two Israeli citizens and a Thai laborer, have been killed by rockets fired from Gaza.

Israel's and Hamas's positions remained far apart regarding a long-lasting halt to hostilities.

Hamas said it would only endorse the ceasefire if Israel removes its troops from the areas into which it has entered in the Gaza Strip.

"Any humanitarian calm that does not include the withdrawal of occupation soldiers from the Gaza Strip and enable the people to return to their houses and to evacuate the wounded is not acceptable," said Sami Abu Zuhri,Hamas spokesman.