Israeli troops were closing in on hospitals in Gaza City on Friday, an Israeli official said, as its battles with Hamas engulfed more of the city and raised fears that vulnerable patients and sheltering civilians with nowhere to flee could be harmed by Israeli strikes and running street battles.

“We’re aware of the sensitivity of the hospitals. That’s why we’re slowly closing in on them,” the Israeli military spokesman, Richard Hecht, told reporters on Friday night.

He said that Israeli forces generally do not fire on hospitals, but added, “if we see Hamas terrorists firing from hospitals, we’ll do what we need to do.” He also said that Israeli troops were “closing in” on Hamas in northern Gaza.

Tanks had surrounded two adjacent hospitals in the city, according to Ashraf al-Qidra, the spokesman for the health ministry of Gaza, which is controlled by Hamas. He said that scores of patients and displaced Gazans were trapped inside them. The situation could not be immediately confirmed, though the Israeli military has made clear that its troops are fighting in the heart of Gaza City.

Israel has ordered hospitals in northern Gaza to evacuate along with residents in the area, and has maintained that Hamas hides military operations within hospitals, and in tunnels underneath them, using civilians as human shields. Israel has struck sites including apartment buildings, mosques and markets, calling them legitimate targets used by Hamas’s military wing.

At least one projectile struck inside the Al Shifa complex, Gaza’s largest hospital, early Friday, though the source and extent of the damage were not immediately clear.

Videos verified by The New York Times showed what appeared to be a projectile flying into the hospital’s courtyard and striking an area where displaced Gazans were resting overnight. The screams of people could be immediately heard. One man was filmed lying on the ground in pain, with his leg apparently mangled. The Gaza health ministry said that one person was killed and several others wounded. The Israeli military said that the projectile was fired by Palestinian militants at Israeli troops.

Mohammad Abu Salmiya, the director of Al Shifa hospital, said in a phone interview that the hospital’s obstetrics ward had been struck twice on Friday by fire, in addition to another area in the complex that had been converted into an emergency room. It was not clear whether he was including the courtyard seen in the video in his account.

The Israeli military declined to comment on whether it was responsible for the strikes.

Hospitals have been caught in the crossfire in the war, and strikes have damaged medical centers and clinics across the coastal enclave. Many displaced Gazans flooded into hospitals and schools, hoping for safety from the relentless, devastating bombing.

The Israeli military has said it struck over 15,000 targets in the Gaza Strip since the beginning of its campaign against Hamas, a figure unrivaled in any of its other Gaza wars. The Israeli military has also said hundreds of Palestinian rockets have gone off course and fallen short within the enclave.

Credit…Bashar Taleb/Agence France-Presse — Getty Images

Doctors at Al Shifa have faced dire conditions as the war has ground on, treating a growing number of patients even as medical supplies and fuel needed to power generators have dwindled.

“At this point, there’s just so little we can do for the wounded we receive, only the bare minimum,” said Dr. Abu Salmiya. “There are people who need complex operations, but we can’t provide them, because we simply don’t have the capacity or the medication.”

The Israeli military has repeatedly singled out Al Shifa in statements in recent weeks, saying that the hospital gives cover to a Hamas military compound. The Israeli military spokesman, Rear Adm. Daniel Hagari, told reporters last month that Hamas “does its command and control in different departments of the hospital.”

Hamas officials and Al Shifa administrators have denied the accusations. Dr. Abu Salmiya said international organizations were welcome to investigate the site and see if they could find any evidence of Hamas’s presence there.

Israel bombed a Palestinian ambulance convoy just outside Al Shifa last week, killing 15 and injuring over 60 civilians, according to the Palestinian Red Crescent Society. The Israeli military took responsibility for the strike, saying it had fired on ambulances ferrying Palestinian fighters.

Credit…Mohammed Al-Masri/Reuters

On Thursday, Israeli troops fought ground battles “near the Shifa hospital,” according to the Israeli military, raiding what it said were Hamas command centers. “The terrorists located in the basements of Shifa tonight can hear the thundering sound of our tanks and bulldozers,” Israel’s defense minister, Yoav Gallant, said on Thursday night.

Inside the Al Shifa hospital itself, staff members were preparing for the worst, including a potential Israeli ground raid into the hospital, Dr. Abu Salmiya said. They have no immediate plans to totally evacuate the complex, he added.

“We will stay with our patients,” he said.