A four-month ceasefire between Israel and Palestinian militants in Gaza was in jeopardy today after Israeli troops killed six Hamas gunmen in a raid into the territory.

Hamas responded by firing a wave of rockets into southern Israel, although no one was injured. The violence represented the most serious break in a ceasefire agreed in mid-June, yet both sides suggested they wanted to return to atmosphere of calm.

Israeli troops crossed into the Gaza Strip late last night near the town of Deir al-Balah. The Israeli military said the target of the raid was a tunnel that they said Hamas was planning to use to capture Israeli soldiers positioned on the border fence 250m away. Four Israeli soldiers were injured in the operation, two moderately and two lightly, the military said.

One Hamas gunman was killed and Palestinians launched a volley of mortars at the Israeli military. An Israeli air strike then killed five more Hamas fighters. In response, Hamas launched 35 rockets into southern Israel, one reaching the city of Ashkelon.

"This was a pinpoint operation intended to prevent an immediate threat," the Israeli military said in a statement. "There is no intention to disrupt the ceasefire, rather the purpose of the operation was to remove an immediate and dangerous threat posted by the Hamas terror organisation."

In Gaza, a Hamas spokesman, Fawzi Barhoum, said the group had fired rockets out of Gaza as a "response to Israel's massive breach of the truce".

"The Israelis began this tension and they must pay an expensive price. They cannot leave us drowning in blood while they sleep soundly in their beds," he said.

The attack comes shortly before a key meeting this Sunday in Cairo when Hamas and its political rival Fatah will hold talks on reconciling their differences and creating a single, unified government. It will be the first time the two sides have met at this level since fighting a near civil war more than a year ago.

Until now it had appeared both Israel and Hamas, which seized full control of Gaza last summer, had an interest in maintaining the ceasefire. For Israel it has meant an end to the daily barrage of rockets landing in southern towns, particularly Sderot. For Gazans it has meant an end to the regular Israeli military raids that have caused hundreds of casualties, many of them civilian, in the past year. Israel, however, has maintained its economic blockade on the strip, severely limiting imports and preventing all exports from Gaza.

Ehud Barak, the Israeli defence minister, had personally approved the Gaza raid, the Associated Press said. The Israeli military concluded that Hamas was likely to want to continue the ceasefire despite the raid, it said. The ceasefire was due to run for six months and it is still unclear whether it will stretch beyond that limit.