Israel's military has withdrawn from Gaza’s largest hospital after a two-week raid, in which it says it killed some 200 militants and detained hundreds more.
Palestinian residents said the troops left behind several bodies and a vast swathe of destruction.
The military has described the raid on Shifa Hospital as one of the most successful of the nearly six-month war.
It said that among those killed were senior Hamas operatives and other militants who had regrouped there after an earlier raid in November, and it seized weapons and valuable intelligence.
The World Health Organisation said 21 patients died and dozens were put at risk during the raid, which brought even further destruction to a hospital that had already largely ceased to function.
The heavy fighting showed Hamas can still put up resistance even in one of the hardest-hit areas of Gaza - months after Israel said it had largely dismantled the militant group in northern Gaza and withdrew thousands of troops.
Israel has accused Hamas of using hospitals for military purposes and has raided several medical facilities.
Health officials in Gaza deny those allegations. Critics accuse the army of recklessly endangering civilians and of decimating a health sector already overwhelmed with war-wounded.
Rear Admiral Daniel Hagari said Hamas and the smaller Islamic Jihad group had established their main northern headquarters inside the hospital.
He described days of close-quarters fighting and blamed Hamas for the destruction, saying some fighters had barricaded themselves inside hospital wards while others launched mortar rounds at the compound.
He said the troops arrested about 900 suspected militants, including more than 500 Hamas and Islamic Jihad fighters, and seized more than $US3 million ($A4.6 million) in currencies, as well as weapons.
He denied any civilians had been harmed by Israeli forces, saying the army had moved more than 200 of the estimated 300 to 350 patients and delivered food, water and medical supplies to the rest.
Mohammed Mahdi, who was among hundreds of Palestinians who returned to the area, described a scene of “total destruction”.
He said several buildings had been burned down and he had counted six bodies in the area.
Another resident, Yahia Abu Auf, said patients, medical workers and displaced people were still sheltering inside the medical compound.
He said army bulldozers had ploughed over a makeshift cemetery in Shifa's courtyard.
“The situation is indescribable,” he said. “The occupation destroyed all sense of life here.”
The military had previously raided Shifa in November after saying Hamas maintained an elaborate command and control centre inside and beneath the compound.
It revealed a tunnel beneath the hospital that led to a few rooms, as well as weapons it said it had confiscated, but nothing on the scale of what it had alleged before that raid.
The war began on October 7 when Hamas-led militants stormed into southern Israel, killing some 1200 people, mostly civilians, and taking about 250 people hostage.
Israel responded with an offensive that has killed at least 32,782 Palestinians, according to Gaza's health ministry.
The Israeli military says it has killed more than 13,000 Hamas fighters.
The war has displaced most of the territory's population and driven a third to the brink of famine.
Israeli Prime Minister Benjamin Netanyahu has vowed to keep up the offensive until Hamas is destroyed and all the hostages are freed.
He says Israel will soon expand ground operations to the southern city of Rafah, where some 1.4 million people - more than half of Gaza's population - have sought refuge.
But he faces mounting pressure from Israelis who blame him for the security failures of October 7 and from some families of the hostages who blame him for the failure to reach a deal despite several weeks of talks mediated by the United States, Qatar and Egypt.
Allied countries, including main backer the United States, have warned him against invading Rafah.
Hamas and other militants are still believed to be holding some 100 hostages after freeing most of the rest during a ceasefire in November in exchange for the release of Palestinians imprisoned by Israel.
Tens of thousands of Israelis thronged central Jerusalem on Sunday in the largest anti-government protest since the country went to war in October.
with AP