Ban Ki-moon today called for those responsible for bombing UN-run buildings and schools in Gaza to be held accountable following Israel's 22-day war on Hamas.
Clearly angry, the United Nations Secretary-General was speaking outside the still-smouldering main UN Relief and Works Agency (UNRWA) compound in Gaza City that was hit during shelling by Israeli artillery last Thursday, setting fire to the building and to the food aid stored inside.
Other UN buildings were hit during the fighting, and a number of Palestinian refugees allowed by the UN to take shelter inside its schools were killed.
"It is an outrageous and totally unacceptable attack on the United Nations," said Mr Ban.
"There must be a full investigation, a full explanation to make sure it never happens again. There should be accountabilty through a proper judiciary system."
The Israeli offensive ended on Sunday, leaving extensive damage in its wake. Some 1,300 Palestinians were killed, and thousands more wounded. A sixth of the buildings in the overcrowded territory were reduced to rubble.
Israel lost three civilians hit by Hamas rocket fire in Israel and 10 soldiers killed in action, including four in "friendly fire" incidents. Some 50 were wounded.
"I have seen only a fraction of the destruction. This is shocking and alarming," Mr Ban told an outdoor press conference. "These are heartbreaking scenes I have seen and I am deeply grieved by what I have seen today."
He condemned "excessive use" of force by Israel, as well as the rocket salvoes fired by Hamas militants into southern Israel that provided the trigger for the assault, which began on December 27.
Israel apologised after the shelling of the UN relief compound but said that its forces had been responding to shooting from gunmen at the facility, a claim that UN officials have denied.
Mr Ban called for Palestinian reconciliation and said that the UN would work with any united Palestinian government to rebuild the Gaza Strip.
He is the most senior international official to visit Gaza since Hamas seized power in the Gaza Strip in June 2007. The Hamas government is not internationally recognised, and Mr Ban is not scheduled to meet the group.
Later, he was due to head to Israel to see a town that has been repeatedly targeted by Palestinian rocket attacks.
Hamas held a rally outside the compound during Mr Ban's visit, calling for international recognition of its Gaza-based government.
The UN and other members of the"Quartet" of Middle East mediators - the United States, the European Union and Russia - have said there could be no dealings with Hamas until it recognises Israel, renounces violence and accepts existing interim peace deals.
Israel is expected to complete the bulk of its troop pullout before Barack Obama's inauguration, scheduled for 1700 GMT today, in an apparent attempt to minimise tension with the new US president.
Meanwhile Gaza residents who fled the fighting were continuing to return to the rubble of what used to be their homes, picking through debris and trying to salvage belongings.
Two Palestinian children playing with unexploded Israeli shell were killed when it detonated, Hamas officials said.
Earlier Mr Ban met Ehud Olmert, the Israeli Prime Minister, and said that he wanted to help to make the unilateral Israeli and Hamas ceasefires "durable".
Mr Ban's call for legal action against Israel was echoed by Arab leaders at a summit of the 22-member Arab Leage in Kuwait. They condemned Israel's attack and demanded its immediate withdrawal from Gaza in the final statement, read by Secretary-General Amr Moussa.
"The summit is holding Israel legally responsible for war crimes it committed, and for taking the necessary action to pursue those who committed the crimes," Mr Moussa said.
The Arab states agreed to help rebuild the battered Gaza Strip, but differences persisted over finding a united stance on the three-week Israeli offensive, with states divided between those allied to Egypt and Saudi Arabia, who have expressed frustration at Hamas for failing to curb its rocket attacks, and those allied to Syria and Qatar.
UNWRA, which has been operating in the Gaza Strip since 1948, said that it had carried out a preliminary assessment of the needs on the ground and determined that at least $330 million of emergency aid spending was required in Gaza after the attack.
The figure is in addition to the $1.6 billion that Western diplomats have estimated will be needed to rebuild essential infrastructure such as roads, bridges, sewerage systems and some of the 22,000 buildings which Hamas said have been damaged.
The Foreign Press Association meanwhile lodged court cases against the Israeli government today for refusing to allow foreign reporters access to Gaza on the grounds that their reports would be biased against Israel.