JERUSALEM — The Israeli military carried out its largest airstrike campaign in Gaza since the 2014 war Saturday as Hamas militants fired dozens of rockets into Israel throughout the day, threatening to trigger an all-out war after weeks of growing tensions along the volatile border.
Two Palestinian teenagers were killed in an airstrike in Gaza City, while three Israelis were wounded from a rocket that landed on a residential home.
Israel said it was focused on hitting militant targets and warned Gaza civilians to keep their distance from certain sites. But even before the report of casualties, the intense tit-for-tat airstrikes and rocket barrages still marked a significant flare-up after a long period of a generally low-level, simmering conflict.
‘‘The Israeli army delivered its most painful strike against Hamas since the 2014 war, and we will increase the strength of our attacks as much as necessary,’’ Prime Minister Benjamin Netanyahu said.
Late Saturday, Hamas and Islamic Jihad militants in Gaza announced that they had agreed to a cease-fire brokered by Egypt, but sirens warning of incoming rockets still wailed in southern Israel early Sunday and it was unclear whether the cease-fire was holding.
Lieutenant Colonel Jonathan Conricus said the latest Israeli sortie, the third of the day, struck some 40 Hamas targets including tunnels, logistical centers, and a Hamas battalion headquarters. He said the escalation was the result of the sustained Hamas rocket attacks, its fomenting of violence along the border, and its campaign of launching incendiary kites and balloons that have devastated Israeli farmlands and nature reserves.
‘‘Our message to Hamas is that we can and will enhance the intensity of our effort if needed,’’ he said. ‘‘What Hamas is doing is pushing them ever closer to the edge of the abyss . . . Hamas will have to understand that there is a price to be paid.’’
Later, witnesses reported that Israeli warplanes dropped four bombs on an unfinished building near a Hamas police and security compound in Gaza City, reducing the old structure to rubble. The four-story building is adjacent to a public park. Gaza’s health ministry said two teenagers were killed in the strike and 10 others injured.
It marked the first casualties of the day. Striking in the heart of Gaza City is typically only seen during full-blown conflicts like the 2014 war and could signal that a further escalation may be in store.
The Israeli military had no immediate reaction to that strike but said it had targeted a separate high-rise building in the northern Gaza Strip that was used as a Hamas urban warfare training facility. It said a tunnel was dug under the building.
Shortly after, Israeli medical officials said three Israelis were wounded from a rocket that landed on a house in southern Israel. It said paramedics in the southern city of Sderot were treating a 52-year-old man with a chest wound, a 17-year-old girl with a face wound, and a 20-year-old woman with injuries to her limbs.
Sirens wailed overnight and throughout most of the day Saturday in southern Israel as waves of rockets and mortars were launched from Gaza amid the airstrikes. The military said it identified about 60 launches of rockets and mortars from Gaza toward Israeli territory, of which about 10 were intercepted by the Iron Dome aerial defense system.
As a precaution, the military shut down a popular beach in southern Israel and placed limitations on gatherings of large crowds. Israeli police says four of the projectiles caused damage.
With Israel focused on rising tension along its northern border in its efforts to prevent Iran from establishing a permanent military foothold in post-civil war Syria, it has been wary of escalating hostilities in Gaza. But Netanyahu has also come under pressure to act from southern Israeli communities, who have once again found themselves under rocket fire from Gaza in addition to contending with the daily field fires.
‘‘We are ready to operate simultaneously in different theaters,’’ Conricus said, referring to the dual threats from Syria and Gaza. ‘‘It will be challenging to fight on more than one border, but it is something we can do and are prepared to do.’’