GAZA CITY, Gaza Strip - Israeli troops and Palestinian militants fought with missiles and mortars along the Gaza-Israel border on Wednesday, raising new concerns that an increasingly shaky five-month-old truce might collapse.

Four Hamas militants were killed in the exchange, and the Hamas military wing said it would retaliate.

Gaza's Hamas rulers and Israeli leaders have said in recent days they're interested in restoring calm, but the latest fighting highlighted the persistent tensions along the border.

Hamas seized control of Gaza in June 2007, and Israel later declared Gaza a "hostile entity." An Egyptian-brokered truce took hold in June.

The Israeli military and Palestinian militants gave conflicting versions of how the fighting started.

Israel's military said it began when Israeli forces spotted armed militants approaching Gaza's border fence, near the southern Gaza town of Khan Younis. The men were trying to lay an explosive device near the fence, the military said.

An exchange of fire erupted. The militants set off an explosive device and fired three mortars at troops, the military said. Israeli soldiers hit four militants and an Israeli soldier was slightly injured, the army said.

Later, Israeli aircraft fired two missiles at open fields, the army said.

Palestinian militants said the battle began when they spotted Israeli forces crossing into Gaza and fired upon them.

The military would not say whether Israeli forces entered Gaza.

Palestinian Health Ministry official Dr. Moawiya Hassanain said ambulances later retrieved the bodies of four Hamas militants from the area of fighting.

Hamas' military wing threatened retaliation. "The anger of our people and our resistance will reach everybody, God willing, and our response to the enemy will be painful, and will spill the Zionists' blood," the wing's spokesman, Abu Obeida, said in a statement.

Earlier Wednesday, Gaza's Hamas rulers stopped short of saying the truce was over but said militants would fight any entry of Israeli forces into Gaza. "This is a clear violation of the truce, and the resistance has the right to respond to any attack," said Fawzi Barhoum, a Hamas spokesman.

The truce began to unravel last week, after Israeli forces trying to destroy a militants' tunnel entered Gaza, setting off battles that killed seven Palestinian gunmen. The fighting unleased a wave of rocket attacks from Gaza at Israeli border towns.

Israeli officials have warned that truce might not last.

"We are looking at the relative calm around us and know that under the surface other things are brewing," said Israel's Defence Minister Ehud Barak said Tuesday in a visit to the army's Southern Command, in charge of Gaza operations.