JERUSALEM — Two Palestinians were killed in an Israeli airstrike and four Israelis were wounded by mortar fire from Gaza on Saturday as fighting in and around the Gaza Strip escalated to what the Israeli prime minister called the most intense level since the 2014 war.

Hamas and allied Islamic militant groups fired nearly 100 projectiles at Israeli territory throughout the day, most of them mortar rounds, though rockets were fired at the city of Ashkelon.

Israel’s Iron Dome air-defense batteries intercepted more than 20 of those that had the potential to do damage, the military said, but some got through. A mortar struck the courtyard of a Sderot synagogue, according to the Israeli military, and local news media reported that a house in Sderot was also hit, wounding four members of a family.

“All the house was smoke and glass,” said one member, Aharon Buchris, from his hospital bed in Ashkelon, where he was treated for head and leg wounds. His wife and two daughters were also hurt. “There was a lot of blood. The television exploded, the aquarium exploded.”

Azzat Magirov, 45, a neighbor, told Ynet that she had accompanied the family’s two daughters, ages 14 and 15, to the hospital. She described hearing “a boom” and then shouting from the neighbors’ home, before running over and finding them all bleeding. The rocket had exploded outside their living room window, and an aquarium inside the house had shattered.

“Dead fish, glass and blood covered the floor,” she said. “The mother was in the kitchen and was in shock.”

She added, “I hugged the children and then I was covered in blood.”

Another Sderot resident, Refael Yifrah, told Kan Radio that she heard a terrifying blast around 6:15 p.m., about 15 seconds after receiving a text alert of incoming fire, but that parked cars bore the brunt of the shrapnel.

“It’s better to be in Gaza where they get warning that they’re going to be fired upon in one neighborhood or another and they evacuate,” Ms. Yifrah said. “Here, there’s an alert, no one knows where it’s going to land.”

The alerts kept coming all day long, and Israeli aircraft pounded at scores of what it called strictly military targets, including tunnels as well as storage sites for helium used to inflate incendiary balloons. The balloons, along with flaming kites, have scorched thousands of acres of Israeli farmland in recent months.

Image

A Palestinian man being treated at Al Shifa hospital in Gaza City on Saturday.CreditAnas Baba/Agence France-Presse — Getty Images

But Israel’s targets on Saturday also included one in downtown Gaza City that Israel said was used by Hamas as a training center for urban warfare and was built atop a tunnel complex used to train fighters in underground combat.

Witnesses said the teenagers were relaxing near the roof of the five-story structure, little more than a concrete skeleton, when Israeli drones struck with warning shots — an Israeli practice known as “roof knocking” — before the bombing began in earnest. In video images released by the Israeli military, a large number of people can be seen running for safety on the building’s rooftop after one of the initial drone strikes.

The building, in Al Katiba Square, sits within a block of Al Azhar University, various Hamas government offices and a grassy square that is a popular picnic spot for Gaza families. A mosque next door appeared largely unscathed aside from some broken windows.

Muhammad Abdelaal, 30, a guard at the ministry of religious affairs, said he raced to the top of the training center after the initial drone strikes and helped carry the two teenagers, who suffered head injuries, down to ambulances, then returned to his post to lock up. Just then, he said, another rocket hit close to him, and he was riddled with shrapnel. He was interviewed at Shifa Hospital while soaked with blood and being treated for his wounds.

Israel said it warned Palestinians in Arabic to steer clear of Hamas locations and centers of militant activity. The initial drone strikes came more than an hour before the building was blown up, said Lt. Col. Jonathan Conricus, a spokesman for the Israel Defense Forces.

“Any uninvolved civilian casualties is regrettable, but the I.D.F. took extreme safety measures in order to signal our intentions and to warn anyone who was near what our intentions were,” he said.

Saturday’s fighting did not arise out of the blue: It came as a ratcheting-up of hostilities a day earlier, when an Israeli army officer was wounded by an explosive hurled across the barrier fence from Gaza, and an unarmed 14-year-old Palestinian boy was shot and killed as he climbed the fence.

The sheer number of mortars and rockets fired from Gaza was itself an escalation. Of roughly 100 launched before 8 p.m., most landed in open areas, said Brig. Gen. Tzvika Haimovic of Israel’s air-defense forces. “We engaged more than 20, each one of them a huge threat,” he said. “A few of them we didn’t intercept, and we saw the damage.” As effective as Iron Dome is, he added, no missile shield is impregnable: “There is no magic solution.”

By Saturday night, the two sides were still exchanging blows, but Hamas said at about 10 p.m. that regional mediation had brought about a cease-fire. It was not immediately clear, however, that this would hold. Each side has tended to insist on getting in the last word.

And Prime Minister Benjamin Netanyahu of Israel posted a message on Twitter assuring his citizens that Israel had “struck Hamas the harshest blow since Protective Edge” — the name for Israel’s 2014 military operation in Gaza — “but we shall increase the force of our attacks as necessary.”

A version of this article appears in print on , on Page A12 of the New York edition with the headline: Heated Fights In Gaza Strip Leave 2 Dead And 4 Injured. Order Reprints | Today’s Paper | Subscribe