A ceasefire between Israel and the Palestinians aimed at ending their seven-week conflict in Gaza appeared to be holding early on Wednesday as the focus shifted to securing an arrangement for the long term.
No clear victor emerged from what had become a war of attrition between the Middle East's most powerful armed forces and the dominant Hamas militant movement in the Gaza Strip.
Exacting a heavy toll in Palestinian lives and property, Israel said it dealt a strong blow to Hamas, killing several of its military leaders and destroying the group's cross-border infiltration tunnels.
But Israel also faced persistent rocket fire for nearly two months that caused an exodus from a number of border communities and became part of daily life in its commercial heartland.
Palestinian and Egyptian officials said the deal, which was mediated in Cairo and took effect on Tuesday evening, called for an indefinite halt to hostilities, the immediate opening of Gaza's blockaded crossings with Israel and Egypt and a widening of the territory's fishing zone in the Mediterranean.
A senior official of the Islamist group Hamas, which runs Gaza, voiced willingness for the security forces of Western-backed Palestinian President Mahmoud Abbas and the unity government he formed in June to control the passage points.
Both Israel and Egypt view Hamas as a security threat and are seeking guarantees that weapons will not enter the territory of 1.8 million people.
Under a second stage of the truce that would begin a month later, Israel and the Palestinians would discuss the construction of a Gaza sea port and Israel's release of Hamas prisoners in the occupied West Bank, possibly in a trade for body parts of two Israeli soldiers believed held by Hamas, the officials said.
After the ceasefire began, crowds and traffic filled the streets of Gaza. Car horns blared and recorded chants praising God sounded from mosque loudspeakers. Celebratory gunfire killed one Palestinian and wounded 19 others, hospital officials said.
"Today we declare the victory of the resistance, today we declare the victory of Gaza," Hamas spokesman Sami Abu Zuhri said.
Israel gave a low-key response to the truce, saying it would facilitate the flow of civilian goods and humanitarian and reconstruction aid into the impoverished territory if the "open-ended" ceasefire was honored.
"We have no problem with civilian support for Gaza," said Mark Regev, a spokesman for Prime Minister Benjamin Netanyahu. "We don’t want to see Hamas rebuild its military machine."
Many residents of southern Israel remained skeptical, and some officials recommended against returning home too soon.
"We had ceasefires in the past that didn't succeed or work out well, and (Hamas) continued with their terror, destruction, with all their craziness, and we no longer believe them," said Israeli Meirav Danino outside a supermarket in the border town of Sderot that for years has been hit by rockets.
The United States and United Nations urged both sides to comply with the terms of the agreement.
"We are all aware that this is an opportunity, not a certainty," said U.S. Secretary of State John Kerry. "We have been down this road before and we are all aware of the challenges ahead."
Palestinian health officials say 2,139 people, most of them civilians, including more than 490 children, have been killed in the enclave since July 8, when Israel launched an offensive with the declared aim of ending rocket salvoes.
Sixty-four Israeli soldiers and six civilians in Israel have been killed - a civilian died after the ceasefire was announced from a mortar attack earlier in the day.
Thousands of homes in the Gaza Strip have been destroyed or damaged in the most prolonged Israeli-Palestinian fighting since a 2000-2005 Palestinian uprising. The United Nations has named a panel to investigate possible war crimes committed by both sides.
The Palestinian Center for Human Rights said 540,000 people had been displaced in the Gaza Strip. Israel has said Hamas bears responsibility for civilian casualties because it operates among non-combatants and uses schools and mosques to store weapons and as launch sites for rockets.
"We have mixed feelings. We are in pain for the losses but we are also proud we fought this war alone and we were not broken," said Gaza teacher Ahmed Awf, 55, as he held his two-year-old son in his arms and joined in the street festivities.
Many of the thousands of rockets fired at Israel were intercepted by the Iron Dome anti-missile system, a partly U.S.-funded project hailed by many Israelis as an example of their nation's high-tech capabilities.
But short-range mortar bombs rained down on farming communities and towns near the Gaza border, putting into question the start of the school year in the area on Sept. 1.