A deadly attack on a school in the city of Rafah in the south of Gaza has been denounced as a "moral outrage" and "criminal act" by the UN secretary general, Ban Ki-moon.

At least 10 people were killed and dozens more wounded after a projectile struck a street outside the school gates on Sunday morning.

The school was sheltering more than 3,000 people displaced by fighting in the area. It has been the scene of heavy bombardment by the Israeli military and fierce clashes following the suspected capture by Hamas fighters of an Israeli soldier, later declared killed in action.

In a statement, Ban called on those responsible for the "gross violation of international humanitarian law" to be held accountable. He said the "Israel Defence Forces (IDF) have been repeatedly informed of the location of these sites."

At the time of the strike – about 10.50am local time – dozens of children and adults were clustered around the gates buying biscuits and sweets from stalls set up by locals.

The missile struck the ground eight to 10 metres from the open gates. Witnesses at the scene less than an hour after the explosion claimed it had been fired from one of the many unmanned Israeli drones in the air above Rafah.

United Nations officials in Gaza described a "shelling incident" or an air strike.

It was impossible to determine the exact provenance of the projectile, but it was the third time in 10 days that a UN school had been hit. Earlier this week, Israeli tank shells lstruck a school in the northern town of Jabaliya, killing 16 in an attack denounced by the UN secretary general, Ban Ki-moon, as "reprehensible".

In all, seven UN schools have been attacked during the conflict.

Israeli spokesmen have previously blamed poorly aimed or malfunctioning Hamas mortar fire or rockets for several such incidents.

Elsewhere in Rafah, more than 30 people were killed in bombing and shelling on Sunday morning, bringing the total number of dead in the city in the past 48 hours to more than 100.

The school – the Rafah Preparatory A Boys school – is one of more than 90 shelters run by the UN in Gaza to provide a safe haven to Palestinians fleeing the fighting. Air strikes and shelling continued across much of Gaza on Saturday despite the Israeli military operation "changing gear", according to spokesmen.

Amid scenes of chaos, wounded from the school were taken to the two small hospital facilities still open in Rafah. With no mortuary facilities available, families collected the bodies of the dead almost immediately. In the corridors of the Kuwaiti hospital, stunned casualties lay on beds or slumped in chairs.

Mohammed Abu Adwan, 15, described how he and his friend, Moaz Abu Rus had been sitting outside the school gates.

"It was just like normal. Some of the kids were buying sweets and that sort of thing. Suddenly there was an explosion. I was hit by shrapnel and they brought me here," he said. His friend, also 15, was killed.

Fatih Firdbari, 30, was outside the school when the explosion occurred.

"I was just talking to my friend and leaning against his tuk-tuk [motorised rickshaw]. There was a big bang. I felt nothing at first and then I fell down. I looked around and saw people lying on the ground. I was wounded in the calf," Firdbari, a farmer who had fled his lands close to the border crossing with Egypt, said.

An hour after the blast, people sheltering in the school washed blood from around the gates and pavement outside.

The dead included a 13-year-old and a 10-year old who live near to the school and had been selling biscuits.

The body of Yusef Iskaafi, 10, was carried into his home by midday, borne by relatives and wrapped in a white shroud. "He was just a normal kid, from a good family. He had no idea what was going on," a neighbour said.

Adnan Abu Hasna, spokesman for the UN Relief and Works Agency in Gaza, said: "It is believed that there was an air strike that hit outside the gate of an UNRWA school, a designated shelter for at least 3,000 displaced residents."

"There were multiple dead and injuries inside and outside the school, including an UNRWA staffer."

Regional efforts to broker a diplomatic end to the fighting between Israel and Hamas have so far proved elusive, with the conflict now in its 27th day with more than 1,700 people killed. Israeli officials say nearly half of these casualties are combatants. However, the UN says only a third are fighters, while local NGOs say four-fifths are civilians.

A Palestinian delegation was to hold truce talks on Sunday in Cairo with senior US and Egyptian officials, but Israel has said it sees no point in sending its negotiators to the meeting, citing what it says are Hamas breaches of previous agreed truces.

Islamic Jihad was also expected to join the talks, along with the US's Middle East envoy, Frank Lowenstein.

Israeli media reported that cabinet ministers have decided not to seek a further negotiated ceasefire agreement with Hamas and were considering ending the military operation unilaterally.

Israel's army announced on Sunday it had begun withdrawing some troops from Gaza.

"We are removing some (forces)," Lieut Col Peter Lerner told AFP that troops were "extremely close" to completing a mission to destroy a network of attack tunnels.

"We are redeploying within the Gaza Strip, taking out other positions, and relieving other forces from within, so it won't be the same type of ground operation," he said.

"But indeed we will continue to operate … (and) have a rapid reaction force on the ground that can engage Hamas if required."

The IDF has claimed that Hamas and other groups launch rockets from close to schools.

"Yesterday Palestinian terrorists fired 11 mortars from the vicinity of an UNRWA school in Zeitoun, Gaza," the IDF said on Twitter about four hours after the strike on the school in Rafah.

The UN has said it has found caches of rockets at schools in Gaza and has criticised those who had put them there for placing civilians at risk.

Israel's assault on Rafah began early on Friday in the opening hours of a 72-hour humanitarian truce, which was quickly shattered when militants ambushed a group of soldiers, killing two.

A third was reported missing, believed snatched in a development that drew sharp condemnation from US and UN officials. But early on Sunday, the Israeli army formally announced the death the soldier, 23-year-old Hadar Goldin, saying he had been "killed in battle in the Gaza Strip on Friday".

Army radio said no body had been recovered, rendering the decision to announce his death "very delicate". There was no word on the whereabouts of his remains.

Hamas's Ezzedine al-Qassam Brigades acknowledged its militants had staged an ambush in which two other Israeli soldiers were killed, but denied holding Goldin.

His death raised to 64 the total number of soldiers killed since the start of the operation, its heaviest toll since the Lebanon war of 2006. Three civilians have been killed in Israel. Hamas have fired about 3,000 rockets across the border, Israeli defence officials say.

An Israeli army spokeswoman said that so far on Sunday at least 13 rockets were fired from Gaza at Israel. One was intercepted by Israel's anti-missile system and the rest landed in open areas.

Israel began its air and naval offensive against Gaza on 8 July following a surge of cross-border rocket salvoes by Hamas and other guerrillas, later escalating the operation into ground incursions.

Benjamin Netanyahu, the Israeli prime minister, vowed to press on with "Operation Protective Edge", promising that Hamas would pay "an insufferable price" for continued cross-border rocket fire.

"We will take as much time as necessary, and will exert as much force as needed," he said late on Saturday, saying troops would complete their mission to destroy the tunnels after which the next security objectives would be decided.

Netanyahu's remarks came after the army gave a first indication it was ending operations in parts of Gaza, informing residents of Beit Lahiya and Al-Atatra in the north that it was safe to return home.

Witnesses in the north confirmed seeing troops leaving the area as others were seen pulling out of villages east of Khan Yunis in the south as commentators suggested it was the start of a unilateral withdrawal.

Local people reported limited shelling overnight in the northern areas though most were reluctant to return to their homes following the breakdown of previous ceasefires.

The IDF has dropped leaflets in parts of Gaza telling local residents to "tell your hidden leaders the battle is over" and that "all members and leaders of Hamas and other terrorist movements are unsafe".

The UN has said 460,000 people had been displaced by the fighting – nearly a quarter of Gaza's population. Doctors say they are running short of medicine and that, after nearly four weeks of conflict, the health system is breaking down.

"We have three or four patients to a room, with open wounds, in August," said one surgeon at the al-Shifa hospital in Gaza City.