An Israeli raid to destroy a Gaza tunnel ignited clashes in which tank and helicopter fire killed four Hamas commanders and five Israeli soldiers were wounded, the two sides said Friday.
In one of the deadliest flareups in Gaza since an October 2012 conflict, warplanes also carried out an air strike after Palestinian militants lobbed between one and three mortar shells into southern Israel.
Neither attack caused any further casualties.
Gaza's Islamist rulers Hamas are under increased pressure from both Israel and Egypt, which has destroyed hundreds of similar tunnels in the south of the besieged Palestinian enclave used to bring in fuel and other goods.
The closures by Egypt forced authorities to shut down Gaza's sole electricity plant early Friday, causing widespread power outages, Hamas said.
The Israeli military said the fighting erupted Thursday night when an explosive device went off as troops were clearing a tunnel from Gaza into Israel, allegedly to be used as a springboard for militant attacks.
Five soldiers were wounded, one seriously, the army said.
In response, "the soldiers opened fire and directly hit a terrorist," and Israeli warplanes struck "an additional terror tunnel located in the southern Gaza Strip," it said.
Palestinian officials said two local commanders of Hamas's military wing, the Ezzedine al-Qassam Brigades, were killed by tank shells, and another two by helicopter fire.
Rabieh Barikeh was killed instantly and Khaled Abu Bakr died of his wounds overnight, according to the officials, who said the commanders were carrying out surveillance along the frontier east of the town of Khan Yunis when they came under fire.
The bodies of Mohammed al-Qassas and Mohammed Daoud were discovered later.
At Barikeh's funeral on Friday, some 2,000 Hamas supporters holding up the movement's flag and shouting "revenge against Israel."
During the exchange, Hamas TV said, three mortar shells were fired from Gaza into southern Israel. The Israeli army reported only one, which it said struck an open field.
"Any Israeli incursion on our land, will not pass without paying the price, & Gaza will be as always a graveyard for the invaders," the Qassam Brigades warned in a tweet on Friday afternoon.
Signup to our newsletter and follow us on Facebook and Twitter!
They also said they had uncovered "part of a spy system used by Israel against resistance in Gaza," but gave no details.
On Friday evening, militants in Gaza fired a missile at southern Israel, the army and police said. According to a police spokesman, the site of the hit "has not been located yet," but there were no reports of injuries or damage.
Sole Gaza power plant shuts down
Israeli military spokesman Peter Lerner said earlier the mission to clear the tunnel, discovered last month, "was imperative due to the potential to utilise the terror tunnel for future attacks against Israeli civilians."
Last month, the Qassam Brigades said it had dug the tunnel as part of a plan to capture Israeli soldiers and hold them in exchange for imprisoned Palestinians.
Sole Gaza power plant shuts down
Hamas, which seized power in Gaza in 2007, enjoyed relative freedom of movement with Egypt for a year before its Islamist president Mohamed Morsi was ousted in July.
The enclave has been under Israeli blockade since the Hamas takeover. Egypt's new authorities, meanwhile, have repeatedly closed the Rafah border crossing and destroyed hundreds of cross-border tunnels.
On Friday morning, Gaza's sole power plant was shut down because fuel had run out, which the energy authority blamed on the destruction of the tunnels.
"We have completely stopped the operation of (Gaza's sole) power plant this morning at 6:00 am (0400 GMT) because we don't have a single litre of fuel," Fathi el-Sheikh Khalil, the energy authority's deputy chairman, told AFP.
The energy authority also accused the Western-backed Palestinian Authority of charging too much for fuel it provides.
It said electricity from Israel covered less than 50 percent of Gaza's needs, and that the Palestinian Authority in the West Bank was charging "prohibitive taxes" on fuel.
The Gaza plant supplies about one-third of the territory's electricity.
It will remain shut until fuel supplies resume from Egypt through the tunnels or the Rafah crossing, or from Israel if the Palestinian Authority agrees not to impose the heavy taxes, said Khalil.