"Several armed terrorists" were identified on the Israeli side of the so-called yellow line in the northern Gaza Strip on Saturday.
The line marks the Israeli army's withdrawal position as part of the ceasefire with the Islamist Palestinian organisation Hamas.
The military said the "terrorists" had emerged from underground infrastructure and taken cover under debris close to Israeli forces, posing what it called an "imminent threat".
Two were killed and others were likely killed as well, the military said.
The information could not initially be independently verified.
Israeli forces were searching the area "to locate and eliminate the remaining terrorists," the military said, adding that their crossing behind the yellow line was a "blatant violation of the ceasefire agreement".
There have been repeated deadly incidents in Gaza since the ceasefire took effect on October 10.
Meanwhile, Doctors Without Borders announced the suspension of some of its operations at one of the largest functioning hospitals in Gaza after patients and staff reported seeing armed, masked men roaming parts of the building.
Nasser Hospital, in Khan Younis, is one of the few functioning hospitals left in the strip. Hundreds of patients and war-wounded have been treated there and the facility was a hub for Palestinian prisoners Israel released in exchange for Israeli hostages as part of the ceasefire deal.
Doctors Without Borders, known by its acronym MSF, said in a statement all its non-critical medical operations at Nasser Hospital were suspended due to "security breaches" that posed "serious security threats to our teams and patients".
While the suspension occurred in January, MSF's comments in the "frequently asked questions" section on its website were the first to disclose its decision. It's unclear when the post was made, but MSF's site said it was updated February 11.
The comments were a rare public announcement by an international organisation about the presence of armed men in or near medical facilities since the war began over two years ago.
MSF said it made the difficult decision after an uptick of patients and staff seeing armed men in parts of the hospital compound since the US-brokered October ceasefire was reached. The gunmen were seen in areas where the medical aid group didn't operate.
"MSF teams have reported a pattern of unacceptable acts including the presence of armed men, intimidation, arbitrary arrests of patients and a recent situation of suspicion of movement of weapons," said the statement.
Throughout the war, Israel has struck hospitals on repeated occasions, including Nasser, accusing Hamas of operating in or around them. Hamas security men have also often been seen inside hospitals, blocking access to some areas of the facilities.
While Hamas remains the dominant force in areas not under Israeli control, including Nasser Hospital, other armed groups have mushroomed across Gaza as a result of the war, including groups backed by Israel's army in the Israeli-controlled part of the strip. Nasser Hospital staff says that in recent months it has repeatedly been attacked by masked armed men and militias, despite police presence there.
MSF said it wasn't able to indicate who the armed men were affiliated with. It said it had expressed its concern to the "relevant" authorities, without elaborating, stressing that hospitals must remain neutral, civilian spaces. It said its concerns were also heightened by previous and deliberate Israeli attacks on health facilities during the war.
Some hostages who were released from Gaza have said that they spent time during their captivity in a hospital.
The Hamas-run interior ministry, which oversees the police force in Gaza, said police would be deployed to secure hospitals and rid them of armed presence. It said it would take legal action against violators and was in the process of implementing stricter measures to ensure patients' safety.
Aid groups and rights organisations say Israel has decimated Gaza's health system, forcing most of its hospitals to shut down while heavily damaging others. During the war, Israeli forces raided a number of hospitals and struck others, detaining hundreds of staff.
with dpa