JERUSALEM — Israeli warplanes, tanks and artillery struck Hamas targets in Gaza on Friday, killing at least four Palestinians, after gunmen killed an Israeli soldier near the border, officials said.

Israeli military officials said the soldier was killed when a "terrorist squad" fired at troops. The military did not give the condition of the other soldiers who came under fire.

"Hamas chose to escalate the security situation — and will bear the consequences for its actions," the Israel Defense Forces said in a statement. It later tweeted that its fighter jets had struck 60 targets, including weaponry warehouses and training facilities.

A spokesman for Hamas told Reuters that the two sides had agreed to a ceasefire on Saturday.

"With Egyptian and United Nations efforts it has been agreed to return to the era of calm between (Israel) and Palestinian factions," Hamas spokesman Fawzi Barhoum told the news agency. Barhoum also said on Twitter Saturday that "calm will be restored."

Israeli officials did not comment on the alleged cease fire, but a Hamas spokesperson said the ceasefire followed the death of an Israeli soldier at the border on Friday.

Israel Defense Forces said Saturday that Staff Sergeant Aviv Levi, 21, "succumbed to his wounds [on Friday] after being shot by a terrorist squad in the Gaza Strip Border." Levi had led a platoon of the "Givati" brigade into the southern portion of the Gaza Strip.

United Nations Secretary General António Guterres said Saturday that he is "gravely concerned over the dangerous escalation of violence in Gaza and southern Israel," and urged both sides to "step back from the brink of another devastating conflict" and work with the UN to find a solution.

"I call on Hamas and other Palestinian militants to cease the launching of rockets and incendiary kites and provocations along the fence," he added. "And Israel must exercise restraint to avoid further inflaming the situation."

Prior to Friday's reported armistice, the Palestinian Health Ministry told NBC News that three Palestinians were killed by Israeli airstrikes and another was killed by sniper fire at the border fence. Some 120 protesters were wounded, the ministry said.

The strikes raised fears of a wider conflict, with the United Nations pleading with all sides to "step back from the brink" of war.

Everyone in #Gaza needs to step back from the brink. Not next week. Not tomorrow. Right NOW! Those who want to provoke #Palestinians and #Israelis into another war must not succeed. — Nickolay E. MLADENOV (@nmladenov) July 20, 2018

Weekly clashes at the Israel-Gaza border have kept tensions high for months. More than 130 Palestinians have been killed by Israeli fire since protests started on March 30.

The protests are partly meant to draw attention to the Israeli-Egyptian blockade imposed after Hamas took control of Gaza in 2007.

Palestinians react with bloodied hands outside a Hamas outpost that was struck by Israeli bombardment near Khan Yunis in the southern Gaza Strip on July 20, 2018. Said Khatib / AFP - Getty Images

Israel has said it is defending its sovereign border and accuses Hamas, the militant group that rules Gaza, of using the protests to disguise attempts to break through the border fence to attack Israeli soldiers and civilians.

Earlier on Friday, Israeli's defense minister, Avigdor Lieberman, visited Sderot, an Israeli town near Gaza that has been pummeled by Palestinian rockets in recent years.

"The leaders of Hamas force us into a situation of no choice, a situation in which we will have to embark on a wide and painful military operation," Lieberman told reporters at a meeting with Sderot residents.

"I think that all the responsibility in this case is for the heads of Hamas. But unfortunately, the residents of Gaza will have to pay the price," Lieberman added.

Lawahez Jabari reported from Jerusalem, Paul Goldman from Tel Aviv, and Daniel Arkin from New York.