Hamas Chief Ismail Haniyeh looks on as he attends the funeral of Palestinian Hamas militants who were killed in Israeli tank fire, at a mosque in Gaza City July 26, 2018. REUTERS/Mohammed Salem

GAZA (Reuters) - Israeli tank shells killed three Palestinian militants as violence flared on the Israel-Gaza border on Wednesday, four days after a truce that had been largely holding.

An Israeli officer was also wounded by a Gaza sniper, the Israeli military said.

Hamas, the armed Islamist group that controls the Gaza Strip, confirmed that the three Palestinians killed were its members but no militant group claimed responsibility for shooting at Israeli troops.

The Israeli military said that militants had fired at its soldiers in the area of the southern Gaza Strip on Wednesday night, and that in response its forces were “targeting Hamas military posts”. Gaza residents said they heard many explosions.

The military said an Israeli officer had suffered moderate wounds and was evacuated to hospital for treatment.

The de facto truce between Israel and Hamas followed violence in which an Israeli soldier and four Hamas fighters were killed on Friday.

Hamas spokesman Fawzi Barhoum said: “The resistance will not abandon its duty in defending its people and protect them and respond to (Israel’s) aggression.”

Sirens warning of militant rockets sounded in Israeli towns and villages around the Gaza Strip but there were no reports of casualties or damage.