U.S. Secretary of State Hillary Clinton meets with Egyptian President Mohammed Morsi, right, in Cairo, on Nov. 21, 2012. (Anonymous/AP)

Egyptian President Mohamed Morsi emerged as the key player in a high-wire feat of international diplomacy between Israel and Hamas on Wednesday, marking post-revolution Egypt’s debut as a major force within the region.

Just months into his role as Egypt’s first democratically elected leader, Morsi became the main interlocutor between Israel and Hamas, the Islamist group that runs the Gaza Strip, as Israel pummeled the enclave with airstrikes and Gaza-based militants fired rockets at southern Israeli towns. The agreement that resulted — some of its details will be hammered out in coming days — was the work of the Egyptians, all sides agreed.

After days of anxious negotiations in this city on the Nile, the bargain that was struck between Israel and Hamas marks a powerful comeback by Egypt on the international stage. The country has long prided itself on being the central arbiter of diplomatic and cultural power in the Middle East but had become increasingly irrelevant under Hosni Mubarak, whose 30-year reign ended last year.

The rapid changes in Egypt have left the United States and Israel with a less pliant but potentially stronger partner, analysts say, as Morsi, an Islamist, can claim to speak for the Egyptian people in a way Mubarak never could. And Egypt’s pledge to underwrite the cease-fire may lay the foundations for Cairo to serve as a trusted go-between in any future peace negotiations.

Morsi managed to keep Israel’s trust while still reflecting Egyptian public opinion, which long chafed at Mubarak’s deferential approach to the neighbor across the Sinai desert. This time around, Egypt came down firmly on the side of Palestinians, while still keeping its peace with Israel and shuttling between the warring sides.

The end result — an agreement between Israel and Hamas, which have long refused to acknowledge each other, brokered by a neighboring Islamist government — would have been unthinkable before the Arab Spring reshaped the region less than two years ago, toppling autocrats who had long held political Islam at bay and strengthening the hand of once-isolated groups such as Hamas.

“Egypt’s new government is assuming the responsibility and leadership that has long made this country a cornerstone of regional stability and peace,” Secretary of State Hillary Rodham Clinton said Wednesday, announcing the cease-fire deal alongside Egyptian Foreign Minister Mohamed Amr.

Her words were echoed by Israeli Prime Minister Benjamin Netanyahu, speaking just minutes before the truce took effect Wednesday night.

“I would like . . . to express my appreciation for the efforts of Egypt to obtain a cease-fire,” he said in Jerusalem.

Egypt “did not forget its status as an Arab nation,” Khaled Meshal, the leader of Hamas, said in Cairo. Hamas is an offshoot of Egypt’s Muslim Brotherhood, which is closely aligned with Morsi.

Egypt’s evolution may be especially important as Turkey, another country that has sought an expanded diplomatic role in the region, has taken a more aggressive tack against Israel. Turkish Prime Minister Recep Tayyip Erdogan said this week that Israel was engaged in “ethnic cleansing” in Gaza, rhetoric that left his country less able to serve as an interlocutor.

Balancing act

Morsi took quick actions last week to condemn the Israeli assault, buying himself time with his own public to work diplomatic channels to end the hostilities. The president recalled his ambassador from Tel Aviv and sent his prime minister to Gaza in the thick of the fighting.

But he also kept Egypt’s intelligence service in touch with its Israeli counterpart, maintaining Mubarak-era contacts in the service of post-Mubarak goals, according to former Egyptian intelligence officials still in close communication with their onetime colleagues. And he spoke six times to President Obama, convincing the U.S. president that there was a deal to be done.

“The feeling here was that he came in as a bit of an unknown quantity,” said an Obama administration official, speaking on the condition of anonymity to describe private discussions. But Morsi came through, the official said, on both Gaza and the storming of the U.S. Embassy in Cairo in September.

Morsi’s balancing act left Israelis appreciative even as Egyptians felt he had taken a hard line. Conservative Egyptians who could have been pushing their leader to escalate the confrontation were instead applauding his actions. Coupled with an overhaul of the Egyptian military that has greatly reduced its power, Morsi has radically revised some of the central tenets of the old order in his country.

“Now we have a Muslim president and a Muslim country,” said Hassan el-Marghany Mohammed Ahmed, 41, a clothing vendor in a religiously conservative neighborhood of northeast Cairo. “We will not leave Gaza alone.”

But the new orientation carries new risks. Had the Israeli troops still massed along the Gaza border invaded, as Israel was contemplating, Morsi would have been under tremendous pressure to open his country’s northeastern border to refugees.

Such a humanitarian move would be a break with the Mubarak regime, which sealed the border during the 2008-2009 Israeli offensive in Gaza. But it could destabilize the already-volatile northern Sinai region and strain a 1979 peace treaty with Israel.

Uncertainty at home

Morsi, a U.S.-educated engineer and longtime Muslim Brotherhood leader, was the group’s second choice for president during May-June elections, after its first pick was disqualified, and many Egyptians expected that he would be a lackluster leader. Many questions remain about the cease-fire, including the extent to which Morsi will be able to guarantee the conduct of Hamas.

And the success abroad comes at a time of uncertainty at home. Egypt’s economic situation continues to deteriorate, and Cairo has been rocked by violent protests in recent days. A train crashed into a school bus last week in central Egypt, killing 52 children. And the group writing Egypt’s new constitution has split over the extent to which Islamic law should influence the charter.

On Wednesday, those domestic problems confronting Morsi melted away, if only for a moment.

“May God keep him in the presidency,” said Meshal, the Hamas leader.

Ernesto Londoño in Tel Aviv, Ingy Hassieb in Cairo and Karen DeYoung in Washington contributed to this report.