JERUSALEM/GAZA, Oct 8 (Reuters) - Israel battered Gaza on Sunday, a day after suffering its bloodiest attack in decades when Hamas fighters rampaged through Israeli towns, killing hundreds and abducting an unknown number of others, threatening a major new war in the Middle East.
In a sign the conflict could spread beyond Gaza, Israeli artillery responded to mortar fire from Lebanon and drone strikes hit a post of the Iranian-backed Hezbollah militia along Israel's northern border.
Overnight, Israeli air strikes had pounded housing blocks, tunnels, a mosque and homes of Hamas officials in Gaza, killing more than 300 people, including 20 children, as Prime Minister Benjamin Netanyahu vowed "mighty vengeance for this wicked day".
In southern Israel, Hamas gunmen were still fighting Israeli security forces 24 hours after a surprise, multi-pronged assault during a rocket barrage smashed through security barriers and army bases to send hundreds of fighters into nearby towns.
Israel's military said it had regained control of most infiltration points, killed hundreds of Palestinian attackers and taken dozens more prisoner but was still fighting in some places.
It said it had deployed tens of thousands of soldiers in the area surrounding Gaza, a narrow strip that is home to 2.3 million Palestinians, and planned to evacuate all Israelis living around the frontier of the territory.
"We're going to be attacking Hamas severely and this is going to be a long, long haul," a military spokesman told a briefing with reporters.
In Gaza, Hamas spokesman Abdel-Latif al-Qanoua said the attack had been "in defence of our people", adding the group's fighters continued rocket strikes and were still conducting operations behind the lines.
The attack represented the biggest and deadliest incursion into Israel since Egypt and Syria launched a sudden assault in an effort to reclaim lost territory in the Yom Kippur war 50 years ago.
The conflict could undermine U.S.-backed moves towards normalising relations between Israel and Saudi Arabia - a security realignment that could threaten Palestinian hopes of self determination and hem in Hamas' main backer, Iran.
Tehran's other main regional ally, Lebanon's Hezbollah, fought a war with Israel in 2006 and tensions have regularly flared since. "We recommend Hezbollah not to come into this and I don't think they will," Israel's army spokesperson said.
The debris from Saturday's attack still lay around southern Israeli towns and border communities on Sunday morning and Israelis were reeling from the sight of bloodied bodies lying on suburban streets, in cars and in their homes.
Gunmen killed at least 250 Israelis in the raid, including senior military officers, as terrified Israelis, barricaded into safe rooms, recounted their plight by phone on live television.
Fighters escaped back into Gaza with dozens of hostages including both soldiers and civilians. Hamas said it would issue a statement later on Sunday saying how many captives it had seized.
The capture of so many Israelis, some filmed being pulled through security checkpoints or driven, bleeding, into Gaza, adds another layer of complication for Netanyahu after previous episodes when hostages were exchanged for many prisoners.
Hamas fired more rocket salvoes into Israel on Sunday, with air raid sirens sounding across the south, and the Israeli military said it would combine an evacuation of border areas with a search for more gunmen.
Netanyahu's office said his security cabinet had approved steps to destroy the military and governmental capabilities of Hamas and Islamic Jihad, another militant group, "for many years", including cutting electricity, fuel supplies and the entry of goods into Gaza.
Israeli air strikes on Gaza began soon after the Hamas attack and continued overnight and into Sunday, destroying the group's offices and training camps, but also houses and other buildings.
Palestinian health officials said 313 people had been killed in Gaza and nearly 2,000 wounded in the retaliatory strikes.
Black smoke, orange flashes and sparks lit the sky from explosions. Israeli drones could be heard overhead. Unlike in some previous rounds of strikes, Israel's military did not give advance warning of strikes on residential buildings.
In a refugee camp in central Gaza, neighbours removed rubble to retrieve the bodies of seven people from one family, including five children, whose house had been bombed.
In Khan Younis, in southern Gaza, people searched through the remains of a mosque early on Sunday. "We ended the night prayers and suddenly the mosque was bombed. They terrorised the children, the elderly and women," said resident Ramez Hneideq.
'WE WARNED YOU'
The escalation comes against a backdrop of surging violence between Israel and Palestinian militants in the Israeli-occupied West Bank, where a Palestinian authority exercises limited self-rule, opposed by Hamas that wants Israel destroyed.
The West Bank has seen stepped-up Israeli raids, Palestinian street attacks and assaults by Jewish settlers on Palestinian villages. Conditions for Palestinians have worsened under Netanyahu's hard-right government.
Peacemaking has been stalled for years and Israeli politics have been convulsed this year by internal wrangles over Netanyahu's plans to overhaul the judiciary.
Hamas leader Ismail Haniyeh said the assault that began in Gaza would spread to the West Bank and Jerusalem. Gazans have lived under an Israeli blockade for 16 years, since Hamas seized control of the territory in 2007.
In a speech, Haniyeh highlighted what he called threats to Jerusalem's Al-Aqsa Mosque, on a site that is also holy to Jews who know it as the Temple Mount, the continuation of Israel's blockade on Gaza and Israeli normalization with countries in the region.
"How many times have we warned you that the Palestinian people have been living in refugee camps for 75 years, and you refuse to recognise the rights of our people?"
In the north, Lebanon's Hezbollah said in a statement it had carried out a rocket and artillery attack on three posts including a "radar site" in the Shebaa Farms, a slice of land occupied by Israel since 1967 that Lebanon claims.
Israel responded with artillery fire on southern Lebanon. There were no reports of casualties.
BIDEN OFFERS SUPPORT TO NETANYAHU
Western countries, led by the United States, denounced the attack. President Joe Biden issued a blunt warning to Iran and other countries: "This is not a moment for any party hostile to Israel to exploit these attacks.
Osama Hamdan, the leader of Hamas in Lebanon, told Reuters that Saturday's operation should make Arab states realize that accepting Israeli security demands would not bring peace.
Across the Middle East, there were demonstrations in support of Hamas while Iran and Hezbollah praised the attack.
That Israel was caught completely off guard was lamented as one of the worst intelligence failures in its history, a shock to a nation that boasts of its intensive infiltration and monitoring of militants.
The main Tel Aviv Stock Exchange indexes opened nearly 5% lower on Sunday. (.TA35), (.TA125)
Reporting by Maayan Lubell in Jerusalem, Nidal al-Mughrabi in Gaza and Ammar Anwar in SderotAdditional reporting by Henriette Chacar, Emily Rose and Dan Williams in Jerusalem, Ali Sawafta in Ramallah; Writing by James Mackenzie, Angus McDowall and Robert Birsel; Editing by Lisa Shumaker, William Mallard and Alex Richardson