Ging said the U.N. had warned the Israeli military that the compound was in peril from shelling that had begun overnight. U.N. officials say they have provided Israel with GPS coordinates of all U.N. installations in Gaza to prevent such attacks.

The U.N. Security Council expressed "grave concern" and requested a briefing from U.N. officials on the attack.

"We are calling all parties to respect international humanitarian law and especially to ensure the protection of civilians," said Jean-Maurice Ripert, France's U.N. Ambassador.

Israeli shells also struck a hospital, five high-rise apartment buildings and a building housing media outlets in Gaza City, injuring several journalists.

Bullets entered another building housing The Associated Press offices, entering a room where two staffers were working but wounding no one. The Foreign Press Association, representing journalists covering Israel and the Palestinian territories, demanded a halt to attacks on press buildings.

The army had collected the locations of media organizations at the outset of fighting to avoid such attacks.

Gaza City resident Sami Helu, 34, was evacuated by the international Red Cross after he, his wife and 8-year-old daughter sheltered from withering fire around their apartment in the Tel Hawwa neighborhood. During the escape, he saw cars and buildings gutted by fire, billowing smoke, bomb craters, speeding ambulances and downed electricity poles.

"I saw suitcases abandoned, I think from people fleeing the area," Helu said. "There was a car still running, there was some money inside."

Many residents had fled to the Quds Hospital on the fringes of Tel Hawwa. But an artillery shell hit the hospital's pharmacy and another landed on the stairs at the entrance.

Sporadic gun fire hit the building as patients and health workers huddled on the first and second floors, medic Khaled Abu Zeid said.