JERUSALEM — Nearly 30 young people took refuge inside a grimy bunker on the morning of Oct. 7, hoping the reinforced-concrete shelter near the border with Gaza would fulfill its promise of protection.

But just after 7:40 a.m., when a group of Hamas assailants, armed with assault rifles and grenades, attacked the shelter near Kibbutz Re’im in southern Israel, the very characteristics that made the tiny fortress a refuge from incoming rockets turned it into a deathtrap for those inside.

In less than an hour, after a desperate defense that included throwing live grenades back at their attackers, more than a dozen of the shelter’s occupants had been killed, their bodies blown apart and riddled with bullets. Others, dazed and injured, were taken to the Gaza Strip as hostages.

The slaughter that took place inside has been pieced together here from interviews with survivors and texts from the victims, as well as authenticated cellphone photographs, videos and dashcam footage from the scene.

In one of the less- documented chapters of the Oct. 7 terrorist attacks, Hamas assailants, using virtually identical methods, attacked multiple shelters in which their victims had sought safety, shattering a symbol of the nation’s sense of security.

There is no official list of who was in the bunker near Re’im, one of hundreds of shelters that dot the roads of southern Israel. As hundreds of young people fled a nearby music festival, Tribe of Nova, that morning, small groups of friends each made the same decision. Seeing a shelter, its exterior painted with a colorful mural of a bird, they pulled their cars off the road and sought safety inside.

“We thought it was a safe place where we would wait awhile, then go home,” said Ziv Abud, 26, a salesperson from Tel Aviv and one of the bunker’s few survivors. She had arrived at the festival around 4:30 a.m. with her boyfriend, her nephew and his girlfriend. Of the four, she was the only one to make it home.

The New York Times has accounted for at least 24 people who were in the shelter at the time of the attacks, although the total number is thought to be 27, or possibly 29. At least 14 were killed, at least three were taken as captives to Gaza, and seven or eight made it home. The fates of several others are unknown.

That Saturday began with a barrage of rockets from Gaza streaking across the sky at sunrise. Organizers of Tribe of Nova, the rave taking place in the desert just off Route 232, abruptly shut down the party around 6:30 a.m., according to survivors, and attendees began leaving by car. By the end of the day, at least 260 of those fleeing the music festival were dead.

As the rocket fire intensified, some of the festivalgoers began receiving confusing messages about gunshots farther down the road. For safety, surviving witnesses said, that was when some took refuge in the shelter.

Such roadside bunkers, about the size of walk-in closets, began appearing in areas near the Gaza border after Hamas and other armed groups started firing rockets into Israel more than 20 years ago. Made of thick concrete, the aboveground shelters have no doors to allow for fast entry because in these parts, incoming- rocket alerts typically give only a few seconds’ warning.

Unknown to those huddling in the shelter — with little or no cellphone reception — more than 1,500 Hamas gunmen were surging across the border, overrunning villages, towns and army bases, and encircling the site of the rave, according to video clips, witness testimony, and police and military records.

Abud; her boyfriend, Eliya Cohen, 26; her nephew Amit Ben Avida, 19; and his girlfriend, Karin Schwartzman, 20, left the rave together after the rocket fire began.

Cohen’s aunt, traveling in a different car, called from farther up the road to say her vehicle had been shot at. Assuming the gunshots were coming from Gaza, Abud and her companions stopped to take refuge in the shelter with the bird mural.

Agam Yosefzon, 20; her boyfriend, Itamar Shapira, 22; and three of their friends, all from Misgav in the Galilee, arrived at the shelter around 7:20 a.m. At first, Yosefzon said, people milled about between incoming rocket alerts. “We were in a good mood,” she said. “We laughed and connected a bit.”

Aner Shapira, 22, an off-duty soldier from Jerusalem, soon arrived with three friends and with the news that Hamas had infiltrated the border area. He reassured everyone that there was a large army base nearby and said that they should remain calm, unaware that base would also fall.

As the sound of gunfire drew closer, everybody crowded into the shelter littered with trash, wasp nests and excrement. Aner Shapira took command, witnesses said, and stood at the entrance.

Soon after 7:41 a.m., according to time-stamped texts and survivors’ testimonies, the attackers arrived outside the bunker. “We thought maybe they would pass us by and not see us,” Abud said. “We kept silent.”

Dashcam footage from a nearby vehicle later posted online shows seven gunmen abusing an Arabic-speaking Bedouin man seated on the ground outside the bunker’s entrance at 7:56 a.m. Survivors said the man pleaded with the gunmen not to enter the building. The man’s family later identified him as Osama Abu Eisa and said he had been killed.

The dashcam footage then shows a gunman tossing a grenade into the shelter as the assailants run for cover. A young man flees the shelter, running across the road. The gunmen fire at him in a frenzy. Witnesses said he was killed.

When the assailants began throwing grenades into the shelter, Aner Shapira, the off-duty soldier, tossed back at least eight stun grenades and live grenades, with some help, according to survivors. But at least one reached deep inside and exploded. Witnesses said the gunmen also fired a rocket-propelled grenade toward the entrance. Shapira was killed. Survivors call him a hero and said he saved their lives.

Abud kept her eyes closed and could only hear what was happening. She said Shema Yisrael, a Jewish prayer. “I heard screams, people’s last breaths, cries for help,” she said.

Yosefzon said she felt like she was being sucked into a black space. “Then I felt my soul return,” she said. “I opened my eyes and saw nothing but orange dust.”

The onslaught did not end there. Once the dust cleared, the assailants entered the bunker and ordered at least three of the surviving men to leave with them. One was Cohen, Abud’s boyfriend, whose leg had been wounded. Alon Ohel, 22, a musician from Misgav who has dual Serbian citizenship, was also taken.

After the kidnappings, the assailants sprayed the inside of the shelter with gunfire. Those who walked out alive said they were able to do so only because they were shielded by the bloody, dismembered bodies of others.