Two Israeli soldiers have been killed during clashes with Hamas fighters on the Gaza Strip's southern border, the Israeli army has said.
Two other soldiers were wounded during the fighting which broke out east of the town of Khan Younis.
Two Palestinian militants were also killed in the clashes inside the Gaza Strip, sources say.
During the clashes, a BBC correspondent says it appears there may have been an opportunistic bid to seize a soldier.
According to Palestinian sources, Israeli forces used tank shells and heavy machine guns, our correspondent adds.
By Jon Donnison BBC News, Ramallah
These clashes came around an attempt by militant groups in Gaza to capture another Israeli soldier to add to Gilad Shalit who has now been held for more than three years.
Local sources in Gaza say fighting broke out after an Israel incursion into the southern Gaza strip. Such incursions are relatively frequent in this area.
It appears that militants in Gaza then tried to capture at least one Israeli soldier. The militant wing of Hamas and another militant group, Islamic Jihad, has claimed responsibility. It could be that members of both groups were involved.
There has recently been a period of growing tension along the border with Gaza. There have been a number of rocket attacks with the Israelis hitting back using airstrikes and other means of retaliation. If the past is any guide, a further military response can now also be expected.
In a statement, reported by the AFP news agency, an Israeli government spokesman said: "An officer and a soldier were killed and two others slightly wounded in an exchange of fire with terrorists planting explosives along the security fence in southern Gaza".
The two men killed were named by Israel's Haaretz newspaper as Eliraz Peretz, 31, and 21-year-old Ilan Sebiatkovsky.
They are the first Israeli soldiers to have been killed in hostile fire in or around Gaza since Israel's major offensive there in January 2009, our correspondent says.
Over the same period, about 90 Palestinians in Gaza have been killed in a mixture of Israeli military operations and border clashes, according to the UN.
Hamas' armed wing - the al-Qassam Brigades - said in a statement sent to the BBC that it had killed the two Israeli soldiers.
Speaking to Reuters news agency, Hamas spokesman Abu Obeida is quoted as saying: "This was our work, but was carried out for defence."
A ceasefire between Israel and Islamist militant group Hamas, which governs Gaza, has largely held since the 2008-2009 conflict with Israel.
Gaza - from which Israel withdrew in 2005 - remains under an Israeli-led blockade, and Israel retains control of most of its borders, its coastline and airspace.
Israel's military said it blamed Hamas for Friday's violence.
"Hamas is accountable for any activity that takes place from Gaza to Israel. It doesn't matter if it took responsibility or not," a spokeswoman said, according to Reuters.
Army spokeswoman Avital Leibovich described the killings of Israel soldiers as both "tragic" and "painful".
"I think it's true to say that this is one of the fiercest days we have had since operation Cast Lead happened," she said, referring to Israel's 22-day offensive.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.