JERUSALEM — Gaza’s militant Hamas rulers said Saturday they had accepted a cease-fire ending a massive Israeli onslaught on militant positions after a soldier was shot dead, once again pulling the sides back from the brink of a full-fledged war.
Israel and Hamas have fought three such wars over the past decade, and Hamas agreed to the second such cease-fire in a week under heavy Egyptian and international pressure.
Even after last week’s cease-fire ended the fiercest exchange of rocket fire and Israeli airstrikes since the 2014 war, incendiary kites and balloons continued to float from Gaza into Israel, setting off damaging fires to farmlands.
Israel has stepped up strikes since then to signal its new threshold for engagement after months of largely refraining to act.
Israel says it has no interest is engaging in another war with Hamas but says it will no longer tolerate the Gaza militant campaign’s flying the incendiary devices into Israel.
On Friday, a Palestinian sniper killed an Israeli soldier along the border — the first casualty it has sustained in four years — and Israel unleashed an offensive it says destroyed more than 60 Hamas targets, including three battalion headquarters.
Four Palestinians were killed, of which three were Hamas militants.
‘‘The attack delivered a severe blow to . . . Hamas’ training array, command and control abilities, weaponry, aerial defense and logistic capabilities along with additional military infrastructure,’’ the Israeli military said in a statement, adding that the strikes ‘‘will intensify as necessary.’’
Israel’s top leadership convened late into the night Friday at military headquarters to discuss potential actions.
Prime Minister Benjamin Netanyahu of Israel and his defense minister, Avigdor Lieberman, spent hours at the military headquarters in Tel Aviv holding emergency meetings with top officials, a highly unusual event for the start of the Sabbath.
In a brief statement early Saturday, Hamas spokesman Fawzi Barhoum said the movement accepted the cease-fire brokered by Egyptian and United Nations officials and that calm had been restored.
Later, the Israeli military announced a return to civilian routine along the volatile border.
UN Secretary-General Antonio Guterres said Saturday he was ‘‘gravely concerned’’ about the escalation and called on both sides to step back from the prospect of another devastating conflict.
‘‘Any further escalation will endanger the lives of Palestinians and Israelis alike, deepen the humanitarian catastrophe in Gaza and undermine current efforts to improve livelihoods,’’ he said.
The recent outburst of violence comes after months of near-weekly border protests organized by Hamas aimed in part at protesting the Israeli-Egyptian blockade of Gaza. More than 130 Palestinians have been killed by Israeli fire since the protests began on March 30.
Israel and Egypt have maintained a blockade on Gaza for over a decade in an attempt to weaken Hamas. The blockade has caused widespread economic hardship in the Palestinian territory.
Israel says the naval blockade is necessary to protect its citizens from weapons smuggling.
Israel says it is defending its sovereign border and accuses Hamas of using the protests as cover for attempts to breach the border fence and attack Israeli civilians and soldiers.
‘‘Hamas terrorists opened fire today on Israelis. Those are not ‘protesters,’ ’’ Foreign Ministry spokesman Emmanuel Nahshon wrote Friday on Twitter.
‘‘We will not tolerate attacks endangering Israelis. Under no circumstance,’’ Nahshon said.
The Israeli retaliation Friday to the soldier’s killing was fierce, but Hamas’s response was far meeker, with just a few projectiles launched that were intercepted by Israel.
Israel announced late Saturday that the casualty was Staff Sergeant Aviv Levi, a 21-year-old infantryman.
Hours before the Israeli soldier was killed, Lieberman visited Sderot, an Israeli town near Gaza that has been hard hit by Palestinian rockets over the years.