JERUSALEM, Oct 24 (Reuters) - Israel's military said it was preparing for "unrelenting attacks" to dismantle Hamas while former U.S. President Barack Obama warned that "any Israeli military strategy that ignores the human costs could ultimately backfire."

The Palestinian health ministry said the Gaza death toll in two weeks of air strikes had topped 5,000.

Israel pounded hundreds of targets in Gaza from the air on Monday as its soldiers fought Hamas militants during raids into the besieged Palestinian strip where civilians are trapped in harrowing conditions.

Hamas on Monday said it had freed two Israeli women among the more than 200 hostages taken during its Oct. 7 rampage in southern Israel in which the Islamist group killed 1,400 people. They were the third and fourth hostages to be released.

Israeli Chief of Staff Lieutenant General Herzi Halevi issued a statement suggesting that Israel had no intention of curbing its strikes on the densely populated Gaza Strip and hinting that it was well prepared for a ground assault.

"We want to bring Hamas to a state of full dismantling," Halevi said. "The path is a path of unrelenting attacks, damaging Hamas everywhere and in every way.

"We are well prepared for the ground operations in the south," he added, referring to southern Israel, which abuts Gaza. "There are tactical, operative, strategic considerations that have provided additional time, and troops who have more time are better prepared, and that is what we are doing now."

In public, the United States has stressed Israel's right to defend itself but two sources familiar with the matter said the White House, Pentagon and State Department have stepped up private appeals for caution in conversations with the Israelis.

A U.S. priority is to gain time for negotiations to free other hostages, said the sources, who spoke before the hostage releases were announced on Monday.

Asked about the possibility of a ceasefire, U.S. President Joe Biden said: ""We should have those hostages released and then we can talk."

Obama, in a rare comment by a former U.S. president on a foreign policy crisis, issued a written statement warning Israel not to cause so many civilian casualties in retaliating against Hamas that it would alienate generations of Palestinians.

"Any Israeli military strategy that ignores the human costs could ultimately backfire. Already, thousands of Palestinians have been killed in the bombing of Gaza, many of them children. Hundreds of thousands have been forced from their homes," Obama said in a statement posted on social media.

It was not immediately clear whether Obama coordinated his statement with Biden, who was his vice president. The White House did not immediately respond to a request for comment.

On Monday, Gaza's health ministry said 436 people had been killed in bombardments over the last 24 hours, most in the south of the coastal enclave next to which Israeli troops and tanks have massed for a possible ground invasion.

The Israeli military said it had struck more than 320 targets in Gaza over 24 hours, including a tunnel housing Hamas fighters, dozens of command and lookout posts, and mortar and anti-tank missile launcher positions.

At least 5,087 Palestinians have been killed in two weeks of strikes, including 2,055 children, the health ministry said.

The Israeli bombardment was triggered by the Oct. 7 assault, the bloodiest episode in a single day since the state of Israel was founded 75 years ago.

Photo from Reuters