UNITED NATIONS — Secretary General Ban Ki-moon said on Wednesday that “all available evidence” suggested that Israeli artillery had hit a United Nations school in Gaza full of civilians who thought they were in a safe zone.

“Nothing is more shameful than attacking sleeping children,” the secretary general told reporters in San Jose, Costa Rica, according to a transcript provided by his office. It was Mr. Ban’s strongest comments to date on attacks on United Nations installations in Gaza, where Palestinians have been taking shelter. Six United Nations staff members have been killed in the current conflict so far.

United Nations officials said that they had informed Israel 17 times of the precise location of the school and that there were civilians sheltering there, including once at 8:50 p.m., just hours before the attack on Wednesday.

Responding to Israeli statements that its soldiers were responding to rocket fire from near the school, the United Nations deputy secretary general, Jan Eliasson, drew attention to the Geneva Convention, which in laying out the rules of war unequivocally prohibits attacks on schools and hospitals.