GAZA CITY — The four Bakr boys were young cousins, the children of Gaza fishermen who had ordered them to stay indoors — and especially away from the beach. But cooped up for nine days during Israeli bombardments, the children defied their parents and went out Wednesday afternoon, the eldest shooing away his little brother, telling him it was too dangerous.

As they played on and around a jetty in the late-afternoon sun, a blast hit a nearby shack. One boy was killed instantly. The others ran. There was a second blast, and three more bodies littered the sand. One was charred, missing a leg, and another lay motionless, his curly head intact, his legs splayed at unnatural angles.

The Israeli military acknowledged later that it had launched the strike, which it said was aimed at Hamas militants, and called the civilian deaths “a tragic outcome.”

The four dead boys came quickly to symbolize how the Israeli aerial assaults in Gaza are inevitably killing innocents in this crowded, impoverished sliver of land along the Mediterranean Sea. They stood out because they were inarguably blameless, children who simply wanted to play on their favorite beach, near the fishing port where their large extended family keeps its boats.

The killings also crystallized the conundrum for the 1.7 million Gazans trapped between Israel’s powerful military machine and the militants of Hamas and its affiliates, who fire rockets into Israel with little regard for how the response affects Gazans. Virtually imprisoned by the border controls of Israel and, increasingly, Egypt, most Gazans have nothing to do with the perennial conflict but cannot escape it.

More than 150 civilians, including more than 40 children, have been killed in Israel’s air assaults in Gaza to curb militant rocket fire. Civilians make up about 75 percent of the Palestinian deaths, according to a running count by the United Nations.

Israel’s military says that it takes extensive precautions to avoid killing civilians and that it does not deliberately target them, and it blames Hamas for operating in populated areas. But it has acknowledged, according to Israel Radio, that about half the people killed so far were “not involved in terrorism.”

In a report issued Wednesday, Human Rights Watch said Israel had repeatedly struck civilians and their property without a clear military purpose and called on it to “end unlawful attacks.” Israel has hit houses, offices and farmland in Gaza with F-16 airstrikes, missiles fired from Apache helicopters and shelling from naval gunboats.

A Gaza beach moments after two explosions on Wednesday killed four boys playing there and leveled a shack. The Israel Defense Forces acknowledged that it was responsible for the “tragic outcome” and said the attack was aimed at Hamas.

TYLER HICKS / THE NEW YORK TIMES

Human Rights Watch has also condemned Hamas for deliberately targeting civilians in Israel. Hamas and allied militants have fired more than 1,000 rockets into Israel since July 8. One Israeli civilian has been killed. Most rockets have fallen in open ground or have been destroyed by Israel’s Iron Dome interception system.

Alon Ben-David, a well-sourced Israeli military affairs analyst, said on Israeli television that the first beach blast targeted a structure that Israel believed was used by Hamas. He said the second blast might have been aimed at the running children, perhaps mistaken for militants. He added that given the military’s technologically advanced surveillance equipment, “it is a little hard for me to understand this, because the images show that the figures are children.”

The killings recalled an episode in June 2006 when seven members of a family, the Ghaliyas, were killed by a shell as they enjoyed a day at the beach. The Israelis said they had shelled areas where militants had fired rockets into Israel, but denied that the shell that killed the family was theirs. No Palestinians believed the denial, and the anger fed an escalating cycle of violence.

At the Bakr family house on Wednesday afternoon, women wept and wailed. One cursed both Israel and Hamas. Another, Nasreen al-Bakr, noted quietly that Hamas had killed 10 of her family members in factional fighting.

Relatives identified the boys as Mohammad, 11 or 12, Ismail, 9, Zakariya, 10, and Ahed, 7 or 9, an only son with seven sisters. In the chaos of an extended family milling about in mourning, there was some confusion about the ages.

Ms. Bakr, 27, said that the day before, she had opposed a proposed cease-fire, wanting to hold out for “a solution” that would end Israel’s restrictions on fishing and allow the family to resume its livelihood.

“Not today,” she said, then reconsidered, adding, “Today, too.” Her nephew’s blood, she reasoned, should not be in vain.

Like many Gaza children from large families, the cousins were inseparable and traveled in a pack. In relatively normal times, they went daily to catch crabs, play soccer and check on the family boats at the beach, where Gazans relax at outdoor cafes. Ahed, with standout grades, was expected to pursue higher studies, while the rest planned to join their elders fishing.

Family members of the four boys were distraught on Wednesday after identifying their bodies at the hospital in Gaza City.

TYLER HICKS / THE NEW YORK TIMES

Mohammad and his brother Ramzi, 8, liked to play roles from a popular Syrian soap opera, Bab al-Hara. Mohammad was Moataz, an insurgent fugitive from French colonial authorities. Ramzi was Moataz’s brother, Issam, a neighborhood leader who stayed close to home. They reprised those roles on Wednesday, when adventurous Mohammad sent Ramzi home. “He was always worried for me,” Ramzi said softly.

As the afternoon turned golden, Tyler Hicks, a New York Times photographer, was in his hotel room facing the beach. He heard “a loud, close blast,” he said. From the window, he saw the shack burning and a boy running. He turned to grab his equipment, then heard another blast. There was a body on the beach. Mr. Hicks ran.

“I saw that boy running,” he said, “and by the time I had reacted he was already dead. That’s the image that will stay with me.”

Men came running, the first to arrive raising his hands to his head in anguish. In such tight neighborhoods, Mr. Hicks said, “people know what family these boys are from and who their parents are.” The boys were carried to the nearby Deira Hotel, where foreign journalists gave first aid to other wounded children.

Later, a little girl with curly hair, a sister of one of the boys, wandered outside the family house, sobbing, the adults too overwhelmed to tend her.

“They were children,” Ms. Bakr, the aunt, said. “They just want to play and study and live a good life.”

Men carried the boys past on stretchers. One dead boy stared skyward, eyes still bright, his features fine and delicate. The wailing became screaming. Throughout the funeral, Mohammad’s father held the boy’s hand to his lips.

Asked what he would miss most about his brother, Ramzi looked at the ground. “Kul,” he whispered in Arabic. “Everything.”

Correction: July 17, 2014

An earlier version of this article misidentified the slain Bakr boy who was an only son with seven sisters. It was Ahed, not Mohammad.