Survivors of an Israeli airstrike on a UN school in central Gaza have described finding children’s bodies that had been torn apart by the blast, as Israeli attacks on the area continued for a second night.

Gaza’s head of civil defence said his teams at al-Sardi school in Nuseirat found only civilians among the dead. Mahmoud Basal said the death toll from the attack was more than 40 and still climbing, because injured survivors could not get proper medical care.

The Israeli military said it had targeted “20 to 30” militants who it claimed used the school as a base, and was “not aware” of any civilian casualties. On Thursday a spokesperson gave the names of two Hamas members and seven members of Palestinian Islamic Jihad it said were killed in the strike.

The attack was part of a campaign in parts of central Gaza which Israeli ground forces had targeted earlier in the war before moving on. They have been drawn back by cells of fighters using insurgent warfare tactics.

At least 15 people were killed in airstrikes in the area on Thursday, Reuters reported, and in southern Rafah Israeli troops killed at least two others as they pushed west.

Mazen Jouda, a 45-year-old sports teacher who lives in Nuseirat, had left for two months at the start of the year to escape the ground invasion, before returning home. Now he wonders if he should leave again.

“Things are getting worse again, with that night [of the school attack] being one of the most difficult: we couldn’t sleep until morning because of all the bombing,” Jouda said.

The strike on the school was so loud Jouda’s children panicked and rushed into their parents’ room; and then the screaming of the injured began. The next morning Jouda went to the school, where the UN said 6,000 people were sheltering.

Three classrooms had been hit on one floor and three on another, and dazed survivors wandered around a courtyard scattered with debris.

Rajab was one of them. He was awake, talking with friends, when the missile hit and the room collapsed. “We did not understand what had happened until some young men came to dig us out from the rubble, and carried us downstairs.

“I got the news of the death of my little brother, who was 10 years old, and they had found him lying at the door of the classroom without his feet or hands. My sister was injured, I was hit by shrapnel in my feet and hands.”

A woman looks down at the courtyard of the school site in Nuseirat. Photograph: Abed Khaled/Reuters

Hisham Shalabi lives opposite the school, and when he realised it had been targeted raced to help. He carried out the body of a man who had been killed, and the fragmented remains of a child, he said.

Hospitals in central Gaza have been overwhelmed by casualties from strikes in recent days, medics warned, and Israel’s operation in the south has blocked medical evacuations for a month.

“From the reports by our teams on the site, the dead were civilians and families who were asleep,” said Basal. “We did not see anything at all that indicates that they are military or resistance.”

Mounir Sorour, also sheltering inside the school, was woken by an explosion. “Nearby someone was screaming ‘oh my God’, then he died,” he said. “Another man next to me was bleeding badly from a leg injury.”

He added: “Didn’t they tell us to go to schools to shelter because they are safe? We actually went to one and exposed ourselves to danger. When will it be enough?”

A UN spokesperson, Stéphane Dujarric, said the school attack was “just another horrific example of the price that civilians are paying” as they try to escape Israeli attacks. “[They] are being forced to move around in some sort of a death circle around Gaza, trying to find safety.”

The US has urged Israel to be “fully transparent” about the strike, saying the government had promised more information. The attack used the same missiles that were deployed to strike near another refugee camp last week, sparking a blaze and killing at least 45 people.

Israel’s attorney general has urged the government to establish a state commission of inquiry into the war in Gaza, in order to address “current international legal risks”, after the international court of justice ordered Israel to stop its operation in Rafah and let more aid into the strip.

The international criminal court prosecutor Karim Khan has also applied for an arrest warrant for the prime minister, Benjamin Netanyahu, who rejected the attorney general’s demand, saying “the time is not ripe”.

Israeli attacks have killed nearly 37,000 Palestinians in Gaza, according to the territory’s health ministry; more than 1 million are on the brink of famine and almost everyone is hungry. Most of the 2.3 million-strong population have had to flee their homes.

The war began after a cross-border attack by Hamas on Israel, when militants killed about 1,200 people and took 250 hostage to Gaza.