GAZA (Reuters) - Israeli tank fire killed up to 40 Palestinians at a United Nations school in the Gaza Strip on Tuesday, medical sources at two Gaza hospitals said.

Two tank shells exploded outside the school, residents said, spraying shrapnel on people inside and outside the building, where hundreds of Palestinians had sought refuge from fighting between Israeli soldiers and Hamas militants.

Reuters journalists filmed bodies scattered on the ground amid pools of blood and torn shoes and clothes. A donkey also lay on the ground in its own blood.

In addition to the dead, several dozen people were wounded, the hospital officials said.

The Israeli military said it was looking into the reports.

Doctors said all the dead were either people sheltering in the school or residents of Jabalya refugee camp, in the north of the Gaza Strip.

A separate Israeli air strike near another U.N. school earlier on Tuesday killed three Palestinians, medics and witnesses said.