By FARES AKRAM and JOSEF FEDERMAN, Associated Press

GAZA CITY, Gaza Strip (AP) — Hamas and other militant groups said Tuesday they had accepted an Egyptian-brokered cease-fire to end two days of intense fighting with Israel that had pushed the sworn enemies to the brink of a new war.

The sudden announcement brought relief to a region that had been paralyzed by hundreds of Palestinian rocket attacks in southern Israel and scores of Israeli airstrikes on targets in the Gaza Strip. But it did not address the deeper issues that pushed Israel and Gaza's Hamas rulers toward their latest violence and left doubts about international efforts to forge a broader truce agreement.

Those efforts had appeared to be making progress in recent days as Israel allowed Qatar to deliver financial aid to the cash-strapped Hamas government, and Prime Minister Benjamin Netanyahu declared that he wanted to avert an "unnecessary" war in Gaza. Hamas, in turn, had scaled back its mass protests that have led to weekly bloodshed along the Israeli border.

But hours after Netanyahu spoke Sunday, an Israeli commando unit on an undercover mission was caught behind enemy lines in Gaza by Hamas militants. Their discovery set off a battle that led to the deaths of seven militants and an Israeli officer, and triggered the heaviest barrage of rocket fire since a 2014 war.

The Israeli military said that Palestinian militants fired 460 rockets and mortars into Israel in a 24-hour period, while it carried out airstrikes on 160 targets in Gaza. Seven Palestinians, including five militants, were killed, and 26 people were wounded. In Israel, a 48-year-old Palestinian laborer was killed in a rocket strike on an apartment building where he was staying. Nearly 30 people were wounded, three critically.

With air raid sirens wailing throughout southern Israel and the explosions of airstrikes thundering in Gaza, the sides had appeared to be headed to what would have been their fourth war in a decade.

But late Tuesday, Hamas and other military groups issued a joint statement saying they had accepted an Egyptian cease-fire.

Terms of the deal appeared to be modest. Daoud Shehab, a spokesman for the Islamic Jihad militant group, said each side would promise quiet in exchange for quiet.

"It's a mutual commitment to the cease-fire," he said. "From our side, we responded positively to the Egyptian endeavor on the condition that the occupation does the same."

The announcement set off celebrations in Gaza City as Hamas supporters declared victory.

At a demonstration staged in the rubble of Hamas' TV station, demolished by an Israeli airstrike, crowds chanted the name of Hamas' military wing. Shops reopened and cars jammed the streets. Israeli reconnaissance drones continued to buzz overhead.

Ismail Radwan, a Hamas official, expressed Hamas' commitment to the cease-fire but warned that "our hands are on the trigger" if Israel violates the agreement.

In Israel, officials had no comment on the cease-fire claim even as dozens of protesters in the rocket-battered town of Sderot chanted "Disgrace!" at what they saw as the government's capitulation to militant violence. But after nightfall, both the rocket attacks and Israeli airstrikes had stopped.

The announcement came shortly after Netanyahu's Security Cabinet ended a seven-hour discussion on the rising tensions in Gaza.

The Cabinet said it had ordered the military to "continue operations as needed." Israel's Channel 10 TV reported deep divisions among the participants, with several hard-line ministers reportedly opposed to another cease-fire with Hamas.

Hamas, an Islamic militant group that opposes Israel's existence, seized control of the Gaza Strip from the internationally recognized Palestinian Authority in 2007.

Israel and Egypt immediately imposed a blockade on Gaza to contain Hamas. The blockade has ravaged Gaza's economy, and Israel refuses to lift it unless Hamas disarms, a demand the militants reject.

The standoff has produced repeated rounds of violence, including indiscriminate Gaza rocket fire at Israeli towns and cities and punishing Israeli military offensives, but Hamas remains firmly in control. Netanyahu's apparent reluctance to launch a full-scale war reflected the lack of good choices at his disposal.

Israel Ziv, a retired general who once commanded the Israeli military's Gaza division, said Netanyahu was running out of options for dealing with Hamas.

"Either we come to a settlement or there's an all-out campaign. Nothing in the middle is going to make a difference," he said.

Tuesday's cease-fire did not appear to address any of the underlying issues, including the blockade and Hamas' vast arsenal of rockets, and it was unclear whether U.N. and Egyptian efforts toward a broader deal might resume.

U.N. and Egyptian mediators had been making progress in recent weeks toward informal understandings between Israel and Hamas that would ease the blockade in exchange for ratcheting down the border protests.

Demonstrators each week approach the border fence, throwing firebombs, grenades and burning tires at Israeli troops. Israeli snipers have killed about 170 people, most of them unarmed. Israel says it is defending its border against attackers, but it has come under heavy international criticism for shooting unarmed people.

In recent days, Israel allowed fuel shipments to increase the power supply in Gaza, which suffers from frequent blackouts, and agreed to additional Qatari assistance to allow Hamas to pay the salaries of its thousands of unpaid workers.

A diplomatic official said the cease-fire included an "understanding" to return to a 2014 cease-fire that promised some relief for Gaza in exchange for quiet.

The official said he expected a return to the situation before the latest burst of violence and for mediators to resume their efforts. He spoke on condition of anonymity because he was not authorized to discuss the matter with the media.

Palestinian U.N. Ambassador Riyad Mansour told reporters at U.N. headquarters that "we are grateful for the Egyptians who are mediating."

The U.N. Security Council scheduled closed consultations on the Hamas-Israel clashes later Tuesday at the request of Kuwait and Bolivia, U.N. diplomats said.

___

Federman reported from Jerusalem. Associated Press correspondent Isabel DeBre in Jerusalem and Edith M. Lederer at the United Nations contributed.