The 10 gunmen from Gaza knew exactly how to find the Israeli intelligence hub — and how to get inside.

After crossing into Israel, they headed east on five motorcycles, two gunmen on each vehicle, shooting at passing civilian cars as they pressed forward.

Ten miles later, they veered off the road into a stretch of woodland, dismounting outside an unmanned gate to a military base. They blew open the barrier with a small explosive charge, entered the base and paused to take a group selfie. Then they shot dead an unarmed Israeli soldier dressed in a T-shirt.

For a moment, the attackers appeared uncertain about where to go next. Then one of them pulled something from his pocket: a color-coded map of the complex.

Reoriented, they found an unlocked door to a fortified building. Once inside, they entered a room filled with computers — the military intelligence hub. Under a bed in the room, they found two soldiers taking shelter.

The gunmen shot both dead.

This sequence was captured on a camera mounted on the head of a gunman who was later killed. The New York Times reviewed the footage, then verified the events by interviewing Israeli officials and checking Israeli military video of the attack as well.

They provide chilling details of how Hamas, the militia that controls the Gaza Strip, managed to surprise and outmaneuver the most powerful military in the Middle East last Saturday — storming across the border, overrunning more than 30 square miles, taking more than 150 hostages and killing more than 1,300 people in the deadliest day for Israel in its 75-year history.

With meticulous planning and extraordinary awareness of Israel’s secrets and weaknesses, Hamas and its allies overwhelmed the length of Israel’s front with Gaza shortly after dawn, shocking a nation that has long taken the superiority of its military as an article of faith.

Using drones, Hamas destroyed key surveillance and communications towers along the border with Gaza, imposing vast blind spots on the Israeli military. With explosives and tractors, Hamas blew open gaps in the border barricades, allowing 200 attackers to pour through in the first wave and another 1,800 later that day, officials say. On motorcycles and in pickup trucks, the assailants surged into Israel, overwhelming at least eight military bases and waging terrorist attacks against civilians in more than 15 villages and cities.

Hamas planning documents, videos of the assault and interviews with security officials show that the group had a surprisingly sophisticated understanding of how the Israeli military operated, where it stationed specific units, and even the time it would take for reinforcements to arrive.

The Israeli military says that, once the war is over, it will investigate how Hamas managed to breach its defenses so easily.

But whether the armed forces were careless with their secrets or infiltrated by spies, the revelations have already unnerved officials and analysts who have questioned how the Israeli military — renowned for its intelligence gathering — could have inadvertently revealed so much information about its own operations.

The outcome was a staggering series of atrocities and massacres, in what the Israeli president, Isaac Herzog, has described as the worst mass killing of Jews in a single day since the Holocaust.

It shattered Israel’s aura of invincibility and provoked an Israeli counterattack on Gaza that has killed more than 1,900 Palestinians in a week, the ferocity of which has never been seen in Gaza.

It also upended assumptions that Hamas, long designated a terrorist group by Israel and many Western nations, had gradually become more interested in running Gaza than in using it to launch major assaults on Israel.

Hamas made Israelis think it was “busy with governing Gaza,” said Ali Barakeh, a Hamas leader, in a television interview on Monday. “All the while, under the table, Hamas was preparing for this big attack,” he added.

The terrorists were inside Addi Cherry’s home, on the other side of an unlocked door.

Ms. Cherry, her husband and their three children were hiding inside their eldest son’s bedroom, listening to the gunmen wander around their living room.

“Please help us,” Ms. Cherry texted a friend, as one of the assailants walked closer and closer to the bedroom door.

Then he gripped the door handle.

The Cherry family’s day had begun with a burst of rockets from Gaza, not long after 6 a.m.

Ms. Cherry, an economist, and her husband, Oren, an engineer, rushed with their children into their eldest son’s bedroom, which doubled as a bomb shelter.

Initially, the events of the morning felt distressingly familiar. The Cherry family lives in Kibbutz Nahal Oz, a rural village of some 500 residents, a few hundred yards east of the border with Gaza. Early morning rocket fire — and the ensuing rush to the safe room — is a frequent feature of life in the region.

“Like always,” Ms. Cherry remembered thinking.

But this morning soon felt different. The rockets kept coming, many of them headed deep into Israeli territory.

Then, from the fields around the village, came the sound of gunshots.

Mr. Cherry left the bedroom, and peeked through the shutters on their living room windows.

“Oh God,” Ms. Cherry remembered her husband shouting. “Hamas in the kibbutz! Hamas in the kibbutz!”

It was 7:20 a.m.

Hundreds of Hamas invaders, carrying guns, shoulder-borne rocket launchers and wearing the group’s green headband, were streaming through the village fields.

It was part of a coordinated assault that, documents and video show, assigned squads of assailants to precise targets. As some swept through military bases, others charged into residential areas, ruthlessly kidnapping and killing civilians.

They would reach the Cherrys’ street within minutes.

The family had to act quickly. Their bomb shelter — a teenager’s bedroom — had no lock.

The parents grabbed a chair, and wedged it under the door handle — making it harder to open.

They dragged a small cabinet, and pressed it against the chair.

Then they waited. There was an army base next to the village. Its troops would be here within minutes, Ms. Cherry remembered thinking.

What she didn’t know was that many of them were already dead.

All along the border, the Hamas gunmen had already overrun most, if not all, of the Israeli border bases.

Footage from the attackers’ head-mounted cameras, including the video of the raid on the intelligence hub, showed Hamas gunmen — from its highly trained Nukhba brigade — smashing through the barricades of several bases in the first light of the morning.

After breaching, they were merciless, gunning down some soldiers in their beds and underwear. In several bases, they knew exactly where the communications servers were and destroyed them, according to a senior Israeli army officer.

With much of their communications and surveillance systems down, the Israelis often couldn’t see the commandos coming. They found it harder to call for help and mount a response. In many cases, they were unable to protect themselves, let alone the surrounding civilian villages.

A Hamas planning document — found by Israeli emergency responders in one village — showed that the attackers were organized into well-defined units with clear goals and battle plans.

One platoon had designated navigators, saboteurs and drivers — as well as mortar units in the rear to provide cover for the attackers, the document shows.

The group had a specific target — a kibbutz — and the attackers were tasked with storming the village from specific angles. They had estimates for how many Israeli troops were stationed in nearby posts, how many vehicles they had at their disposal, and how long it would take those Israeli relief forces to reach them.

The document is dated October 2022, suggesting that the attack had been planned for at least a year.

Elsewhere, other assailants were posted to key road junctions to ambush Israeli reinforcements, according to four senior officers and officials.

Some units had specific instructions to capture Israelis for use as bargaining chips in future prisoner exchanges with Israel.

“Take soldiers and civilians as prisoners and hostages to negotiate with,” the document said.

The terrorists smashed their way into the Cherrys’ house shortly before 10 a.m., according to texts that Ms. Cherry sent friends at the time.

They had already killed the kibbutz guards, as well as a civilian security volunteer who had rushed to confront them in the opening moments of the assault, according to the village leadership.

Now, the terrorists were going house by house, trying to find people to kill and kidnap.

“Please send help,” Ms. Cherry typed into her phone.

At the Cherrys’ house, they forced in the door. Then they charged in, shouting and ransacking the house, Ms. Cherry said.

“We are going to die,” Ms. Cherry remembered thinking.

The family waited in terrified silence, hoping the intruders would ignore the door to the bedroom and assume everyone was away.

Mr. and Mrs. Cherry put all their weight against the cabinet, to brace the chair underneath the door handle.

Guy, 15, their eldest son, stood next to the door, holding an 18-pound dumbbell. If someone did break in, the plan was to drop it on the assailant’s head.

Then the handle twitched.

The parents began to push the cabinet.

The handle continued to rattle.

Then it stopped. The assailant walked away.

A few streets away, the family of Miki Levi, who oversees the kibbutz gardens, had an even closer call.

After a terrorist squad chased Mr. Levi, 47, inside his safe room, the attackers sprayed bullets at the reinforced door, Mr. Levi said in an interview.

Some of the bullets pierced the door, creating large openings, and Mr. Levi said he also fired back with his pistol, shredding it further. His wife and two young daughters sheltered to the side.

Changing tactics, the terrorists later brought two of his neighbors — a mother and her 12-year-old daughter, Mr. Levi said.

At gunpoint, the mother and child were told to persuade him to open up, Mr. Levi said.

“‘Come out and stop shooting,’” Mr. Levi recounted one of them saying. “‘The terrorists won’t do anything to you.’”

Eventually, the terrorists gave up that approach and returned with a rocket-propelled grenade launcher, Mr. Levi said.

It was only when Mr. Levi shot one attacker in the thigh that they finally left, he added.

The mother and child, Mr. Levi suspects, are now captives in Gaza.

Brig. Gen. Dan Goldfus said he drove south without knowing where exactly he should go.

General Goldfus, 46, a paratrooper commander, had been on leave at home, jogging in his neighborhood north of Tel Aviv. Then he saw a video from the south, showing terrorists cruising through a city, entirely unimpeded.

Without waiting for orders, the general said he ran home, changed into his uniform and headed south.

He picked up guns and two soldiers from his base in central Israel, and called friends and colleagues to find out what was happening.

Only a few picked up. Of the rest, “There was nobody really understanding the full picture,” General Goldfus said in an interview.

The speed, precision and scale of Hamas’s attack had thrown the Israeli military into disarray, and for many hours afterward civilians were left to fend for themselves.

Using the few scraps of information he could glean, General Goldfus said he and the soldiers headed to a village north of Nahal Oz, and then gradually worked their way south.

It was around 10 a.m. All around him was carnage and atrocity.

Dead Israelis lined the roads, alongside the husks of burned-out, overturned cars.

At the site of an all-night outdoor rave, gunmen had killed an estimated 260 partygoers.

“Bodies were burning,” General Goldfus remembered seeing at the site.

The attack by Hamas had unleashed a violent free-for-all. Some residents of Gaza had poured over the undefended border after it was breached, at times streaming what they were doing on their phones. Gazans were looting and ransacking homes, taking computers, clothes, crockery, televisions and phones, survivors said.

In some Israeli villages, residents had been burned alive in their homes, while terrorists stalked civilians at every turn, looking for people to capture and kill. Grandparents, toddlers and a nine-month-old baby were seized and taken back to Gaza, some of them squeezed between their kidnappers on motorcycles.

And during much of the mayhem, the Israeli army was almost nowhere to be seen.

Near Kibbutz Reim, General Goldfus said he ran into another senior commander by chance. Like him, the officer had rushed to the scene on instinct, without any instructions, and had assembled a small group of soldiers.

There and then, the two men came up with their own ad hoc strategy.

“There’s no orders here,” General Goldfus said. “I said: ‘You take from this place and further south — and I’ll take from this place and further north.’”

That was how some of the Israeli counterattack took place: soldiers or civilian volunteers — including retired generals in their 60s — rushing to the region and doing what they could.

Israel Ziv, a former general, reached a nearby battle in his Audi.

Yair Golan, a retired deputy chief of staff and former leftist lawmaker, said he took a gun and began rescuing survivors of a massacre at a rave, who were hiding in nearby bushes.

“We are brought up to run as fast as possible toward the fire,” said General Goldfus. “So that we can be the first one there.”

The intelligence hub near Gaza was one of the first places to be recaptured by Israel.

In the late morning, soldiers and reservists from different units reached the base from separate directions, overpowering the 10 Gazan gunmen who had filmed their deadly assault on video.

The camera mounted on the Hamas commander’s head captured the moment he was shot and killed. The camera falls off, bouncing along the ground. By the time the video stops, the commander can be seen slumped on the ground, revealing his long beard and thinning hairline.

In other parts of southern Israel, the first formal reinforcements came from an Israeli commando unit that arrived in helicopters, according to the senior Israeli officer.

They were followed by other special operations units, including Israeli navy seals and a reconnaissance unit trained to operate deep inside enemy lines, rather than on Israeli soil.

Sometimes, the commandos joined forces with volunteers without body armor who had rushed into the fray to rescue family members.

Noam Tibon, a former general, drove south with his pistol to try to retake Kibbutz Nahal Oz, where his son, Amir, a journalist, was trapped.

In the early afternoon, the elder Mr. Tibon joined a squad that was making its way through the kibbutz, house by house.

By Sunday afternoon, several villages and bases still had some kind of Hamas presence. The whole area would not be fully secured for days.

Ms. Cherry emerged around 5 p.m. on Saturday in Kibbutz Nahal Oz to find her home turned upside down, the microwave torn from the wall, drawers ripped from their cabinets and a pool of drying blood on the floor.

She had heard a gun battle in and around her home earlier in the day. She believed a terrorist had died in the house — and that his bloodied corpse had been carried off by fellow fighters.

Some survivors refused to open up, even after the army arrived.

When soldiers reached the home of Oshrit Sabag, another resident of Kibbutz Nahal Oz, she feared they were terrorists in disguise.

Even after the soldiers began chatting to one another in Hebrew, to prove who they were, Ms. Sabag, 48, was unconvinced.

It was only their Jewish prayers that made her relax.

“‘It’s O.K., it’s O.K.,’” Ms. Sabag remembered them saying. “‘We’re Jewish.’”

Aaron Boxerman contributed reporting from Jerusalem.