Israeli soldiers head south near Ashkelon, Israel, Israel, on October 7, 2023. [AP photo]

It was not immediately clear what prompted Hamas to launch its attack, which came after weeks of simmering tensions along the Gaza frontier. The shadowy leader of Hamas' military wing, Mohammed Deif, announced the start of what he called "Operation Al-Aqsa Storm."

"Enough is enough," he said in the recorded message, as he called on Palestinians from east Jerusalem to northern Israel to join the fight. "Today the people are regaining their revolution."

In a televised address, Israeli Defense Minister Yoav Gallant warned that Hamas had made "a grave mistake" and promised that "the state of Israel will win this war."

The attack comes at a time of historic division within Israel over Netanyahu's proposal to overhaul the judiciary. Mass protests over the plan have sent hundreds of thousands of Israeli demonstrators into the streets and prompted hundreds of military reservists to avoid volunteer duty - turmoil that has raised fears over the military's battlefield readiness.

Videos posted on social media showed what appeared to be the lifeless body of an Israeli soldier being trampled by an angry crowd of Palestinians shouting "God is Great." Other footage appeared to show Palestinian militants dragging away an Israeli soldier, still alive, on a motorcycle and Palestinian men dancing atop a stolen Israeli tank that had been set ablaze. The authenticity of the videos could not immediately be verified.

"We are in a state of war," said Kobi Shabtai, the Israeli police chief. "There is no other explanation."

The infiltration of fighters into southern Israel marked a major accomplishment - and escalation - by Hamas. Millions of people were hunkering down in safe rooms, sheltering from rocket explosions and ongoing gunbattle with Hamas fighters.

Cities and towns emptied as the military closed roads near Gaza. The army ordered residents near the Palestinian enclave to stay inside. Israel's rescue service appealed to the public to donate blood.

"We understand that this is something big," said Lt. Col. Richard Hecht, an Israeli army spokesperson. He said the Israeli military had called up the army reserves.

Hect declined to comment on how Hamas had managed to catch the army off guard. "That's a good question," he said.

Salah Arouri, an exiled Hamas leader, said the operation was a response "to the crimes of the occupation." He said fighters were defending the Al-Aqsa Mosque in Jerusalem and the thousands of Palestinian prisoners held by Israel.

In the kibbutz of Nahal Oz, just 4 kilometres from the Gaza Strip, terrified residents who were huddled indoors said they could hear constant gunfire echoing off the buildings as firefights continued even hours after the initial attack.

"With rockets we somehow feel safer, knowing that we have the Iron Dome (missile defence system) and our safe rooms. But knowing that terrorists are walking around communities is a different kind of fear," said Mirjam Reijnen, a 42-year-old volunteer firefighter and mother of three in Nahal Oz.

 Rockets are fired toward Israel from Gaza on October 7, 2023. [AP photo]

Israel has built a massive fence along the Gaza border meant to prevent infiltrations. It goes deep underground and is equipped with cameras, high-tech sensors and sensitive listening technology.

The escalation comes after weeks of heightened tensions along Israel's volatile border with Gaza, and heavy fighting in the Israeli-occupied West Bank. It also comes at a delicate time for Netanyahu's far-right government, with hundreds of soldiers in the military reserves either pulled out of training sessions or promising they won't report for duty over the government's deeply divisive plan to weaken the Supreme Court.

The divisions within army ranks have threatened to undermine Netanyahu's reputation as a security expert who would do anything to protect Israel and the cohesion of an institution crucial to the stability of a country locked in low-intensity conflicts on multiple fronts and facing threats from Lebanon's Hezbollah militant group.

Hezbollah congratulated Hamas on Friday, praising the attack as a response to "Israeli crimes" and saying the militants had "divine backing." The group said its command in Lebanon was in contact with Hamas about the operation.

Israel has maintained a blockade over Gaza since Hamas seized control of the territory in 2007. The bitter enemies have fought four wars since then. There have also been numerous rounds of smaller fighting between Israel, Hamas and other smaller militant groups based in Gaza.

The blockade, which restricts the movement of people and goods in and out of Gaza, has devastated the territory's economy. Israel says the blockade is needed to keep militant groups from building up their arsenals. The Palestinians say the closure amounts to collective punishment.

The rocket fire comes during a period of heavy fighting in the West Bank, where nearly 200 Palestinians have been killed in Israeli military raids this year. In the volatile northern West Bank, scores of militants and residents poured into the streets in celebration at the news of the rocket barrages.

Israel says the raids are aimed at militants, but stone-throwing protesters and people uninvolved in the violence have also been killed. Palestinian attacks on Israeli targets have killed over 30 people.

The tensions have also spread to Gaza, where Hamas-linked activists held violent demonstrations along the Israeli border in recent weeks. Those demonstrations were halted in late September after international mediation.