JERUSALEM (AP) — Israel and Hamas on Monday accepted an Egyptian cease-fire proposal meant to halt a bruising monthlong war that has claimed nearly 2,000 lives, raising hopes that the bloodiest round of fighting between the bitter enemies could finally be coming to an end.
Still, both sides signaled a rough road ahead, with an Israeli official expressing skepticism given previous failures, and a Palestinian negotiator saying ‘‘it’s going to be tough.’’
A last-minute burst of violence, including a deadly Palestinian attack in Jerusalem, continued bloodshed in Gaza and the reported execution of a number of suspected collaborators with Israel, served as reminders of the lingering risk of renewed violence.
After weeks of behind-the-scenes diplomacy, Israel and Hamas both announced late Monday that they had accepted the proposal for a preliminary 72-hour truce, beginning at 8 a.m. (0500 GMT) Tuesday. Egypt was then set to host indirect talks to work out a long-term truce over the next three days.
‘‘At 8 a.m. local time tomorrow a cease-fire starts and Israel will cease all military operations against terrorist targets in the Gaza Strip,’’ said Israeli government spokesman Mark Regev. ‘‘Israel will honor the cease-fire and will be watching to see if Hamas does, too.’’
The war broke out on July 8 when Israel launched an air offensive in response to weeks of heavy rocket fire out of Hamas-controlled Gaza. It expanded the operation on July 17 by sending in ground forces in what it described as a mission to destroy a network of tunnels used to stage attacks. Israel says the last of the tunnels has nearly been destroyed.
The war has taken nearly 1,900 Palestinian lives, most of them civilians caught in fighting inside Gaza’s crowded urban landscape, according to Hamas medical officials. Sixty-four Israeli soldiers have also died, as well as two Israeli civilians and a Thai laborer who worked in Israel. The heavy death toll has eclipsed that of previous rounds of fighting in 2009 and 2012.
A delegation of Palestinian officials from various factions, including Hamas, has been negotiating with Egypt in recent days. Hamas spokesman Fawzi Barhoum said the group had accepted the plan.
‘‘It’s clear now that the interest of all parties is to have a cease-fire,’’ said Bassam Salhi, a member of the Palestinian delegation. ‘‘It’s going to be tough negotiations because Israel has demands too. We don’t have any guarantees the siege will be removed.’’
Hamas is seeking a full Israeli withdrawal from Gaza, an end to an Israeli and Egyptian blockade of the territory, the release of Hamas prisoners held by Israel and international assistance in the reconstruction of Gaza.
Israel says the blockade is needed to prevent Hamas, an Islamic militant group sworn to its destruction, from arming. But the Palestinians and members of the international community have criticized the blockade as collective punishment. The blockade, known to the Palestinians as ‘‘the siege,’’ has ground Gaza’s economy to a standstill.
Israel has demanded that Gaza become ‘‘demilitarized,’’ requiring the unlikely cooperation of Hamas in giving up its significant arsenal.
‘‘We will be putting first on our agenda preventing Hamas from rearming,’’ Regev said. ‘‘Ultimately the Palestinians have a written commitment that Gaza should be demilitarized and it’s time the international community held them to that commitment.’’
Israel had been signaling in recent days that it was winding down its military campaign. On Sunday, it withdrew most of its ground forces from Gaza, and the army said the pullout was continuing Monday.
In addition, Israel declared a seven-hour pause Monday in its air campaign for what it called a ‘‘window’’ to allow much-needed humanitarian aid into Gaza.
Supermarkets were open for business and more cars were on the streets than during any of the short-lived cease-fires since the war began. Fresh fruits and vegetables were available in outdoor markets.
Despite a drop in military activity, Israel still attacked 38 targets, though well below the levels of recent days.
At least 20 people were killed Monday, including three children — an 8-year-old girl in the Shati refugee camp and a 12-year-old boy and his 5-year-old sister in the southern border town of Rafah, according to Palestinian medical officials. Still, that was far below the levels during the heaviest fighting.
Israel’s chief military spokesman, Brig. Gen. Moti Almoz, disputed Palestinian claims that the vast majority of the dead were civilians.
‘‘We estimate that between 700 and 900 terrorists were killed in direct contact with Israeli soldiers,’’ he told Channel 2 TV. ‘‘That’s a number that could rise because there were many terrorists inside the tunnels that were probably killed when the tunnels were blown up.’’
Almoz said Israel expected to destroy the last of the tunnels, allegedly built by militants to stage attacks across the border, in the coming hours.
As the fighting appeared to be tapering off, a Palestinian website close to the Hamas internal security service in Gaza said an unspecified number of Palestinians accused of collaborating with Israel were executed.
It said the alleged collaborators were caught ‘‘red-handed’’ providing information to Israel, including details on certain houses and alerts about planned ambushes. ‘‘The resistance will show no mercy to anyone tempted to provide information to the enemy,’’ the al-Majad website said.
In Jerusalem, an assault carried out with a construction vehicle served as another reminder of the tense climate.
Israeli TV stations broadcast a series of amateur videos of the attack, in which a Palestinian man used the front shovel of a construction excavator to ram a bus and tip it over.
Police said a man who worked at the site was run over and killed by the construction vehicle. He was identified as a 29-year-old religious inspector whose job was to ensure that ancient graves were not damaged by construction work.
A policeman who happened to be in the area shot the driver, who was identified as a resident of a Palestinian neighborhood in east Jerusalem. The man’s uncle, Hisham Jaabis, said the incident was a traffic accident and that his nephew had been gunned down in cold blood while trying to dodge the bus. ‘‘All of them started shooting at him,’’ he said.
In the past, Palestinian attackers have gone on deadly rampages with bulldozers in Jerusalem traffic.
Shortly after the excavator attack, a gunman on a motorcycle shot and seriously wounded an Israeli soldier in Jerusalem. Police called it a ‘‘terrorist’’ attack, signaling alleged Palestinian involvement, and searched for the shooter in east Jerusalem.