GAZA CITY, Gaza Strip - Israeli artillery shells struck the UN headquarters in the Gaza Strip on Thursday, setting a food warehouse ablaze and drawing a sharp rebuke from the visiting UN chief who called it an "outrage." Another Israeli bombardment killed Hamas' head of security.
  
The attack added to a day of deadly chaos pitting Israeli troops against Islamic militants. Terrified residents huddled in shelters and stairwells, or scooped up toddlers and fled on foot.

After nightfall, shells landed near Gaza City's Quds Hospital, where many families had sought refuge, and the building caught fire, forcing staff to evacuate hundreds of people. According to a hospital medic, some patients were pushed down the street on gurneys; a few held white flags.

The destruction added to what aid groups say is a humanitarian crisis in Gaza and ratcheted up tensions between Israel and the international community even as diplomats indicated progress in ceasefire talks.

Israeli Foreign Minister Tzipi Livni was departing Thursday night for Washington to discuss a Gaza ceasefire with U.S. Secretary of State Condoleezza Rice. The United States and Egypt have been working to forge an agreement to end 20 days of bitter fighting.

The UN compound, made up of workshops and warehouses as well as offices, was struck about a half-dozen times over a roughly two-hour period while more than 700 civilians were sheltering there, said John Ging, head of Gaza operations for the UN Relief and Works Agency.

The civilians were huddling in the compound's vocational training centre when it was struck by a tank round or an artillery shell, causing the three injuries, Ging said. Throughout this time, he said, UN officials were frantically contacting Israeli officials to urge an end to the firing on the UN compound.

Israeli Prime Minister Ehud Olmert said Hamas militants opened fire from the UN compound. "It is absolutely true that we were attacked from that place, but the consequences are very sad and we apologize for it," he said. The military said it was still investigating.

The attack triggered a raging fire that engulfed a warehouse and destroyed thousands of kilograms of food and other aid intended for Gaza's beleaguered citizens.

Workers with fire extinguishers and Palestinian firefighters, some wearing bulletproof jackets, struggled to douse flames and tugged bags of flour from the debris.

Fuel supplies and cars in a garage also went up in flames.

Ging said the contacts with Israeli officials were made under a new liaison system aimed at preventing any attack similar to the shelling at a UN school in northern Gaza earlier this month that killed about 40 people. At the time, Israel said militants had fired on army positions from the area.

An Israeli air strike killed Interior Minister Said Siam, a key figure in Hamas who oversaw thousands of security agents, Hamas TV said. A top aide, Siam's brother and his brother's family also were killed.

"We are talking about a key person in terms of logistics in the field, and also in the political sense," said Bassem Zbeidy, a Hamas expert in the West Bank.

He said Siam's death was a "huge loss for Hamas," but noted that the movement is easily capable of generating new leaders, often more radical than their predecessors.

Israel's intense assaults Thursday seemed to reflect an extra push to pressure Hamas negotiators into making concessions on a ceasefire and punish the militant group as much as possible before any end to hostilities.

Israeli envoy Amos Gilad was ordered to return to Cairo Friday for more truce talks.

On Thursday he discussed a ceasefire proposal three with Egyptian officials, who are also trying to coax Hamas into ending the war. After meeting with Olmert and others on his return, it was decided to send Gilad back, Olmert's office said.

Israel launched the offensive Dec. 27 to end Hamas rocket attacks on Israel. Gaza medics say about 1,100 Palestinians, half of them civilians, have died; 13 Israelis have also been killed.

UN Secretary General Ban Ki-moon, visiting Israel, said Israeli Defence Minister Ehud Barak told him the attack on the UN compound was a "grave" error and apologized for it.

"I conveyed my strong protest and outrage to the defence minister and foreign minister and demanded a full explanation," said Ban, who arrived Thursday from Egypt.

Israel's chief military spokesman, Brig.-Gen. Avi Benayahu, said the military had not clarified the incident and that an investigation was underway.

"If it becomes clear that we returned shots at the source of fire, we will say so, and if it turns out we operated by mistake, we will not hesitate to confess," Benayahu told Israeli television.

Ging described the Israeli claim as "total nonsense" and "typical misinformation."

He said his staff in Tel Aviv was told by the Israeli liaison office "that there were no militants in the compound. There were militants operating ... in the area, but no militants or any firing from our compound. That's the official position of the Israeli authorities that deal with us. It happens, to my knowledge here, to be representative of the facts."

UN officials said hundreds of people sheltering in the compound were forced to flee, and that the Israeli shells contained white phosphorus, an incendiary agent that can cause horrific injuries. After the shelling, fire spread to nearby fuel tankers in the compound, triggering another massive blast.

The UN compound distributes food aid to hundreds of thousands of Palestinians in the tiny seaside territory of 1.4 million people.

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

The UN Security Council expressed "grave concern" and requested a briefing from UN officials.

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

An artillery shell hit the Quds Hospital pharmacy, and another shell landed on its front steps early in the day. It caught fire after nightfall, forcing the evacuation.

"There's gunfire, and warplanes above us," medic Abdul Aziz Aishe said by cellphone as he and a group of people fled. Ambulances ferried them to another hospital.

Dr. Moaiya Hassanain, a Gaza health official, said at least 70 people were killed or died of wounds throughout Gaza on Thursday.

Israeli shells also hit five highrise apartment buildings and a building housing media outlets in Gaza City, injuring several journalists.

Bullets hit a building housing offices of The Associated Press, 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 media buildings.

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

Israeli police said 20 rockets hit southern Israel, injuring 10 people. Five of the wounded were in a car in the city of Beersheba.