WASHINGTON (AP) — President Barack Obama said Wednesday that the United States will use all its diplomatic resources and relationships to secure a deal on a cease-fire to end violence between Israel and Hamas in the Gaza Strip.

Obama said the US supports Egypt’s continued efforts to restore the 2012 cease-fire. He said the US was working with its partners in the region to secure a cease-fire and would stay in close contact during the next 24 hours.

Obama said Israel has a right to defend itself against rocket attacks, but also lamented the deaths of civilians in Gaza. He stressed the need to protect civilians in Gaza and in Israel and to avoid further escalation.

“There’s no country on Earth that can be expected to live under a daily barrage of rockets,” Obama said at the White House.

“But over the past two weeks, we’ve all been heartbroken by the violence, especially the death and injury of so many innocent civilians in Gaza — men, women and children who were caught in the crossfire. That’s why we have been working with our partners in the region to pursue a cease-fire, to protect civilians on both sides.

“Now, yesterday Israel did agree to a cease-fire. Unfortunately, Hamas continued to fire rockets at civilians, thereby prolonging the conflict.”

The Israeli military has agreed to a UN-brokered five-hour “humanitarian” pause starting Thursday in its strikes on the Gaza Strip to allow Palestinians to restock food, water and other necessities. An attack Wednesday by an Israeli naval vessel killed four Palestinian boys playing on the beach.

In response to a call by the UN, the Israeli military said in a statement Wednesday that it would hold its fire for five hours starting at 5 a.m. EDT. But it warned it will retaliate “firmly and decisively” if Hamas or other militant groups launch attacks on Israel during that time. It also said residents of three Gaza neighborhoods who on Wednesday asked to leave their homes should be out by the time the pause expires.

The announcement came after a day of Israeli airstrikes and Palestinian militant rocket attacks as Hamas formally rejected a cease-fire proposal that had been accepted by Israel to end the nine-day conflict that officials say has left at least 213 Palestinians and one Israeli dead.

Copyright 2014 The Associated Press