JERUSALEM — Israel launched its most ferocious assault on Gaza in four years Wednesday after persistent Palestinian rocket fire, hitting at least 20 targets in aerial attacks that killed the top military commander of Hamas, damaged Israel’s fragile relations with Egypt, and escalated risks of a new war in the Middle East.
The Israel Defense Forces coupled the intensity of the airstrikes with the threat of a ground invasion of Gaza similar to its three-week operation in the winter of 2008-09, shifting infantry brigades and calling up some specialist reserves. The Israelis also warned all Hamas leaders in Gaza to stay out of sight or risk the same fate as the Hamas military commander, Ahmed al-Jabari, who was killed in a pinpoint airstrike as he was riding in a car down a Gaza street.
‘‘We recommend that no Hamas operatives, whether low level or senior leaders, show their faces above ground in the days ahead,’’ the Israel Defense Forces said in a Twitter message. Brigadier General Yoav Mordechai, the military spokesman, said, ‘‘If I were a senior Hamas activist, I would look for a place to hide.’’
The escalation in hostilities between Israel and Hamas, the militant organization regarded by Israel as a terrorist group sworn to its destruction, prompted Egypt to recall its ambassador and demand meetings of the UN Security Council and the Arab League.
Israel had already been facing growing tensions with its Arab neighbors. Israel has confronted lawlessness on its border with Sinai, including cross-border attacks. It recently fired twice into Syria, which is caught in a civil war, after munitions fell in the Israeli-occupied Golan Heights, and it has absorbed more than 750 rockets fired from Gaza into southern Israel this year. The rockets have hit homes, caused injuries, and frightened the population.
It is both the rocket fire and the buildup of advanced weaponry in Gaza that has increasingly tested Israeli officials and prompted such an intense attack, according to military experts in Israel.
‘‘Deterrence has to be maintained,’’ said Gabi Siboni, a colonel in the reserves who leads the military and strategic affairs program at the Institute for National Security Studies in Tel Aviv. ‘‘It was only a question of time until this moment arrived.’’
The Hamas-run Health Ministry in Gaza said the Israeli attacks killed at least five others besides Jabari, including a baby and a 7-year-old girl, and had wounded at least 40.
The ferocity of the airstrikes provoked rage in Gaza, where Hamas said the campaign amounted to war and promised a harsh response. It quickly launched dozens of rockets into southern Israel. Several barrages struck the city of Beersheba, shattering windows and damaging cars but causing no injuries.
Civil-defense authorities in Israel, anticipating retaliation, instructed residents within a 25-mile radius of Gaza not to go to school or work Thursday. Many remained indoors or congregated in bomb shelters.
Mordechai said the operation ‘‘would continue and grow.’’ The military said it was designed to ‘‘severely impair the command and control chain of the Hamas leadership.’’
By targeting Jabari, 52, the Israelis said they had killed the mastermind of virtually every attack to come from Gaza in recent years, including the kidnapping in 2006 of Israeli soldier Gilad Shalit. Jabari was involved in the negotiations to release Shalit, whose five years as a prisoner was a source of national anguish. When he was finally released through Egypt, Jabari made a rare public appearance alongside him.
The attacks on Gaza were undertaken at a delicate time for Prime Minister Benjamin Netanyahu, nine weeks before elections, and may have partly reflected his administration’s own sense that it needed to send a message of deterrence beyond Gaza. In a statement, Netanyahu praised the military for the operation and said: ‘‘We will not accept a situation in which Israeli citizens are threatened by the terror of rockets. No country would accept this.’’
In Washington, the White House issued a carefully worded statement saying that President Obama had spoken with both Netanyahu and President Mohamed Morsi of Egypt, reiterating to both that the United States supports Israel’s right to self-defense from the rocket attacks.
The statement said that Obama had urged Netanyahu to ‘‘make every effort to avoid civilian casualties,’’ and that Obama and Morsi ‘‘had agreed on the importance of working to de-escalate the situation as quickly as possible.’’