We hurried into the complex through the bombed-out remains of a building on the outskirts of the site, escorted by Israeli special forces, picking our way through rubble. They said it was still too dangerous to pass through the main gate because of fighting nearby.

Inside, we found a squad of Israeli soldiers sleeping in a cafeteria-turned-makeshift-dormitory. A few dozen yards away, a few lights glimmered from the windows of the hospital itself — proof, the Israelis said, that the hospital continued to function despite their presence.

But we were not allowed to switch on our phones to call the hospital management, and the state of the hospital could not be confirmed. The World Health Organization said this week that Al-Shifa had ceased to function as a hospital, and doctors interviewed by Al-Jazeera, a Qatari news channel, said this week that conditions had markedly worsened.

Seeking to justify their presence at the hospital, the soldiers took us to see a stone-and-concrete shaft on its grounds with a staircase descending into the earth — evidence, Israeli officials said, of a Hamas military facility under the hospital.

But Col. Elad Tsury, commander of Israel’s Seventh Brigade, said that Israeli forces, fearing booby traps, had not ventured down the shaft. He said it had been discovered on Thursday afternoon under a pile of sand on the northern perimeter of the complex.

In the darkness, it was unclear where the shaft led or how deep it went, although the military said it had sent a drone down at least several meters. Electrical wiring was visible inside, along with the metal staircase.

When we left, half an hour later, the shaft’s purpose remained unresolved.

So, too, was the fighting nearby.

As we squeezed back into the personnel carrier, gunfire continued to rattle from the neighboring streets.

Reporting was contributed by Philip P. Pan in Gaza City, Abu Bakr Bashir in London and Ameera Harouda in Doha, Qatar.