Israeli tanks fired artillery shells and machine guns after coming under attack by anti-tank missiles, killing five Palestinians and wounding more than 40 in the southern Gaza Strip, the army and Palestinian witnesses said.

The dead Palestinians included two men, two women and a girl, said Dr. Ali Musa, head of Rafah Hospital. Many of the Palestinians were hit by tank fire while inside their homes, Palestinians said.

The clash erupted as Israeli troops were working on a new lookout tower at a military base in the Gaza town of Rafah, on the border with Egypt.

Palestinian militants fired anti-tank missiles at the Israeli forces, who then returned fire, said Lt. Col. Olivier Rafowicz, an Israeli military spokesman. "Terrorists in the Rafah area operate amid the civilians," he said.

Palestinians said youths threw stones and bottles at the troops, and that mourners at a nearby Palestinian funeral fired shots into the air. But the Palestinians claimed that no guns or missiles were fired at the troops.

The area is a frequent clash point, and Thursday's funeral was for a man killed in the same area a day earlier. Israeli troops have bulldozed the homes closest to the base, leaving several hundred yards of no-man's land between the two sides.

At the Rafah Hospital, the emergency room was overflowing.

"I was cooking for my children, when suddenly there was the sound of a tank shelling and there were explosions all around," said Naifa Abu Jazzer, a 40-year-old woman whose face and body was covered with blood.

"One tank shell hit the house. When I started leaving the house, another tank shell hit it and I was injured," she said.

Nearby, five children were being treated for wounds.

Rafah is a stronghold for militants and Palestinians also smuggle weapons into Rafah from tunnels that go under the border into Egypt, the Israeli military says.

Israeli troops often come under fire in Rafah, the army says. Palestinians accuse Israeli soldiers of firing indiscriminately and frequently hitting civilians.