In an interview, he recalled the final days of the battle for the Iraqi city of Mosul, where Islamic State fighters hid in a series of tunnels in 2017. “Our Iraqi soldiers were clearing out, using bulldozers, ISIS fighters who were literally dug into the rubble,” he said. “It was very, very brutal.”

Tunnels have been a part of life in Gaza for years, but they sharply multiplied after 2007, when Hamas took control of the enclave and Israel tightened its blockade. Palestinians responded by building hundreds of tunnels to smuggle in food, goods, people and weapons.

The tunnels cost Hamas about $3 million each, according to the Israeli military. Some are made with prefabricated concrete and iron, and have medical rooms for providing aid to wounded fighters. Others have spaces 130 feet below ground where people can hide for months.

In Israel, people often refer to the tunnel system as “lower Gaza” or the “metro.”

Yocheved Lifshitz, an 85-year-old woman who was held hostage by Hamas for 17 days this month, described being marched for miles through a “spider web” of tunnels. She told reporters on Tuesday that Hamas militants led her through the wet and humid underground corridors to “a big hall where some 25 kidnapped were concentrated.”

After two or three hours, they put five people from her kibbutz in a separate room, she said.

At a news conference on Friday, Rear Adm. Daniel Hagari, an Israeli military spokesman, accused Hamas of building tunnels and other facilities underneath Al Shifa Hospital in Gaza, the territory’s largest medical center. He played an intercepted audio recording and displayed an illustration of the subterranean complex.

General Votel, who visited a tunnel controlled by the Lebanese militia Hezbollah near Israel’s border, said he was “taken aback at the level of effort that is involved in creating these things.”

“This wasn’t just holes in the ground, it was an architecture,” he said. “They were linked to rooms and built in a way to withstand strikes to the surface.”

As Hamas expanded the underground system, it concealed the entrances to the tunnels in houses and other small structures on Egypt’s side of the border, said Joel Roskin, a geology professor at Bar-Ilan University in Israel who studied tunnels during his time in the Israeli military. Those tunnels allowed goods to be smuggled in from Egypt.

The tunnel system stretches all the way to the Israeli border in the north.

A decade ago, Egypt undertook an effort to destroy the tunnels along its border, dumping sewage into some and leveling houses that concealed entrances, Mr. Roskin said.

Israel has limited visibility into tunnel activity on the Egyptian side of the border, he added. Many of the networks end in Northern Sinai, but the Egyptian government has rarely allowed Israeli researchers or government officials to visit the area, so it is not clear how many cross-border tunnels remain.