CAIRO -- The Egyptian president, Mohamed Morsi, has fired back at Israel from the arsenal of diplomacy as Israeli strikes on the Gaza Strip confront him with a wrenching test of loyalties, to Hamas and to Egypt's landmark peace treaty with Israel.
In just two days, Mr. Morsi has recalled Egypt's ambassador to Tel Aviv, dispatched his prime minister on a solidarity mission to Gaza, called President Obama, the European Union, the United Nations and the Arab League for support, and even publicly instructed top generals to inspect air bases and prepare land defenses near the Gaza border. He has a stepped up to the very limits of Egypt's obligations to Israeli -- without stepping over.
But as the Israeli assault continues, Mr. Morsi's own quandary will only deepen, squeezed between a public that recalls with resentment how former President Hosni Mubarak did virtually nothing to aid the Palestinians during the Israeli assault in 2009, and the desperate need to preserve the stability of the cold peace with Israel in order to secure Western aid and jump-start his moribund economy.
Both sides in the conflict appear to be testing Egypt's new leader. Hamas, the Islamist Palestinian offshoot of Egypt's Muslim Brotherhood, is wondering how much support it may draw from its ideological cousins now that they control the Egyptian state, while Israel's hawkish leadership seem to probe the depth of Mr. Morsi's stated commitment to the peace treaty as well.
For Mr. Morsi the test is forcing him to reconcile conflicting elements of his own persona: as the Islamist firebrand who has denounced the Israelis as "vampires" for killing Palestinian civilians and lauded Hamas for resisting an illegal occupation, but also as the newly elected president promising stability, economic revival and friendly relations with Israel's Western allies.
In his public statements at least, Mr. Morsi has so far vowed full backing for Hamas and the Palestinians, winning praise at home.
"The Egyptian people, the Egyptian leadership, Egyptian government and all of Egypt is standing with all its resources to stop this assault, to prevent the killing and bloodshed of the Palestinians," Mr. Morsi declared Thursday in a televised address to the country in response to the attacks. "Israelis must recognize that we do not accept this aggression."
In Egypt's domestic politics, the crisis has rallied a sense of national unity behind the president. Bitter opposition to Israel's occupation of the Palestinian territories and treatment of their residents may be the only unifying cause binding together Islamists, their secular critics and even the leadership of the Coptic Christian church. And even Mr. Morsi's rivals and detractors have cheered the vigor and alacrity of his response, said Emad Shahin, a political scientist at the American University of Cairo, arguing that Mr. Morsi's swift action would enable him to hold at bay the inevitable calls for Egypt to go further.
"He is doing everything he can within the legal obligations of Egypt's relationship with Israel," Mr. Shahin said.
But even within Egypt's bureaucracy, voices previously held silent under Mr. Mubarak have come close to calling for retaliatory violence against Israeli civilians. The officials in charge of Egypt's ministry for religious endowments and its official Islamic Affairs Council issued a joint statement calling for the Palestinian "resistance" to "strike the Zionist depth" and "prove that they are tougher and stronger" than they were during the last major clashes between Hamas and Israel three years ago.
Mr. Morsi should "fulfill the promise he made to preachers and scholars that he won't allow for Palestine to be hit, or for Palestinians to be killed," the statement said, urging Egypt to expel the Israeli ambassador and asking Muslim preachers to rally support for Gaza at Friday prayer, "to direct the masses of the nation everywhere in the world to practical revenge, rather verbal revenge, against the people of Zion."
In the streets, protesters burned an Israeli flag outside the Arab League off Tahrir Square in Cairo.
Since winning leadership of the post-Mubarak Parliament, the Egyptian Brotherhood has urged Hamas to try to maintain tranquil relations with Israel in order to help the Brotherhood's Freedom and Justice Party steer Egypt to stability, officials of both groups have said. Freedom and Justice Party leaders have said that as a governing party they planned to take a step back from Hamas in order to try to broker a reconciliation between the group and its Western-backed rival faction, Fatah, which controls the Palestinian Authority in the West Bank.
Hamas has not recognized Israel, the Brotherhood long ago came to support a two-state solution as envisioned by the Camp David accords, and since Mr. Mubarak's ouster it has pledged to uphold Egypt's peace with Israel.
Surprising some, Mr. Morsi has not opened Egypt's border to Gaza and instead has moved aggressively to try to shut down or blow up smuggling tunnels from the Egyptian Sinai long used by Hamas to circumvent an Israeli boycott, contending that they pose a security risk to Egypt.
This article originally appeared in The New York Times.