The United Nations Relief and Works Agency plans to continue to operate in Gaza and to distribute humanitarian aid to Palestinian refugees there, even after the IDF shelling of its large headquarters in Gaza City on Thursday, according to its spokesman Christopher Gunness. Over the course of an hour in the late morning, seven IDF shells landed in the UNRWA compound, destroying thousands of pounds of food and tons of fuel that had been stored there and which would have been distributed today to Palestinians in need, according to the head of UNRWA's Gaza operations, John Ging. A huge cloud of black smoke rose from the UN compound, visible across Gaza City. Flour spilled on the ground and mixed with soot, as Palestinian firefighters tried to douse the flames leaping toward the sky. One UN worker and two Palestinian civilians who had sought refuge in the compound were wounded in the attack, Ging told The Jerusalem Post by phone from Gaza. It was the second IDF attack on a UNRWA compound since Israel began its military operation in Gaza 20 days ago. Last week, an IDF shell hit a UNRWA school compound and killed 39 people. UN Secretary-General Ban Ki-moon, who arrived in Israel on Thursday for a brief visit, sharply criticized Israel for the attack. "Today, the UN compound in Gaza has been shelled again. I conveyed my strong protest and outrage to the defense minister and to the foreign minister, and demanded a full explanation," he said at a press conference in Jerusalem. "I had a telephone call with the defense minister before I began my meeting with the foreign minister. Defense Minister [Ehud] Barak said to me that it was a grave mistake and that he took it very seriously. He assured me that extra attention would be paid to the UN facilities and staff and that this should not be repeated." Prime Minister Ehud Olmert said the military had fired artillery shells at the UN compound after Hamas operatives opened fire from the location. "It is absolutely true that we were attacked from that place, but the consequences are very sad, and we apologize for it," he said. "I don't think it should have happened, and I'm very sorry." Ging and other officials in UNRWA have strongly denied charges that Hamas gunmen fired from their compound. "In a coordinated meeting with UNRWA this afternoon, Israeli army representatives said that the firing came from several hundred meters outside the UNRWA compound," Gunness told the Post. Ging said there had been no Hamas gunmen in the compound. He added that UNRWA had received an apology for the attack from both Barak and Olmert. As of Thursday night, the IDF had issued no formal statement on the matter, but its officials privately said IDF troops from the Givati Brigade had come under anti-tank fire from gunmen standing next to the compound. The officials said the IDF had responded by firing artillery shells at the gunmen and that it appeared that one of the shells had accidentally hit a UN warehouse, setting it afire. IDF Spokesman Brig.-Gen. Avi Benayahu said the incident was still under investigation. "If it becomes clear that we returned shots at the source of fire, we will say so, and if it turns out we acted by mistake, we will not hesitate to confess," he told Channel 2. Ging said he had been in his office in the compound around 10:30 a.m. or 11 a.m. when he heard a massive explosion. He said he had already been on the phone with the IDF liaison because the compound had been subject to a lot of shrapnel. UNRWA coordinates with the IDF to prevent such attacks, since the IDF is not suppose to hit their compounds, he said. "That is the problem. Throughout the conflict, we have been given assurance and reassurance," which the IDF has not adhered to, he said. On Thursday morning, an IDF shell hit a vocational training center where some 700 Palestinian civilians had fled for safety only an hour earlier. "The shelling has been incessant, and people are beside themselves with fear," said Ging. An hour after the vocational center was hit, six more shells hit a warehouse filled with food, as well as a workshop for cars and the fuel depot where five trucks were loaded with thousands of liters of fuel, Ging said. It took six hours to get the fire under control, said Ging, adding that the warehouse had been totaled. He charged that a white substance that appeared to be phosphorous had come out of the shells when they exploded, and spread everywhere, making it more difficult to put out the flames. UN workers and Palestinian firefighters, some wearing bulletproof jackets, struggled to pull bags of food from the debris after the attack. The food was intended for UNRWA's distribution program. Even before the fighting began, UNRWA provided basic food supplies for 800,000 people in Gaza. It now also houses 40,000 Palestinians whose homes have been destroyed in the last few weeks or who have sought safety from IDF fire in their area. Gunness said UNRWA had been able to distribute some food on Thursday in spite of the shelling, and that it planned to continue to do so. Still, Ging said 30 trucks had been pinned down by the fighting and were unable to pick up humanitarian aid from Gaza's borders. "What it means is that the operation on the ground is not being resupplied today," he said. "It's a major interruption in our pipeline." Yaakov Katz and AP contributed to this report.