GAZA CITY, Gaza (CNN) -- The U.N. chief has visited the burned-out shell of a U.N. compound in Gaza and urged both Israeli and Palestinian leaders to achieve political reconciliation after what he said was the "heartbreaking" violence of the last three weeks.

Palestinians in Gaza face a huge task to rebuild their lives after Israel's bombardment.

"The repeated violence felt by Palestinians and Israelis is a mark of collective political failure," Secretary-General Ban Ki-moon said Tuesday.

Speaking less than three days after Israel and the Palestinian militant group Hamas each agreed to a cease-fire to end three-weeks of intense fighting, Ban had strong words for both sides.

"I have condemned from the outbreak of this conflict the excessive use of force by Israeli forces in Gaza. I view the rocket attacks into Israel as completely unacceptable. We need to restore basic respect for civilians," he said.

He also called on Palestinian factions to unify under the framework of the Palestinian Authority.

He described seeing "heartbreaking scenes" and said he was "deeply grieved by what I have seen today."

Ban planned to travel next to Sderot, a city in southern Israel where civilians have been targeted by Hamas rocket attacks from Gaza for years.

While his trip through the region is aimed largely at pushing all players to avoid a resumption of the violence, it is also to push for an investigation into Israel's shelling of the U.N. compound.

"I'm just appalled. I'm not able to describe how I am feeling having seen this site," he said, adding that he could smell the facility still burning. "It is an outrageous and totally unacceptable attack against the United Nations."

Earlier, Ban met Israeli Prime Minister Ehud Olmert and expressed his relief that Israel had declared a cease-fire, according to the U.N. chief's spokesperson. Ban also stressed the importance of the full withdrawal of Israeli troops from Gaza. Watch more on withdrawal of Israeli troops »

Ban also told Olmert that the U.N. would continue to play a pivotal role in providing humanitarian assistance to the people of Gaza, as well as in long-term recovery and reconstruction, the spokesperson said.

Don't Miss

He told Olmert he was visiting Gaza in solidarity with U.N. staff who had worked heroically, and to demonstrate his respect and concern for all Gazans who lost friends and families.

More than 1,300 Palestinians died and about 5,400 others were wounded during Israel's three-week offensive in Gaza, according to the Palestinian Authority's Central Bureau of Statistics. Among the dead were 159 children.

More than 22,000 buildings were damaged or destroyed, with the Bureau putting the cost at more than $1.9 billion.

Israel said its offensive was aimed at stopping Hamas militants from firing rockets into southern Israel.

The attacks destroyed public sector and private buildings in Gaza, affecting even the United Nations Relief and Works Agency's facilities and halting economic and social services, the statistics agency said.

Gaza's gross domestic product was slashed by 85 percent during the 22 days of war, and it could take a year for the economy to recover, the agency said in a preliminary report.