JERUSALEM — Israel on Wednesday launched the most ferocious assault on Gaza in four years 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 the 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, recalling its three-week operation in the winter of 2008-9, 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. Brig. Gen. 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 United Nations Security Council and the Arab League.