CAIRO — At the start of the year, Egyptian President Abdel Fatah al-Sissi appeared to be stuck in diplomatic quicksand.

His cozy ties with President Donald Trump were ending. The incoming president, Joe Biden, had vowed that there would be “no more blank checks” for Trump’s “favorite dictator,” warning Sissi to improve his abysmal human rights record. In the first four months of his presidency, Biden didn’t even phone Sissi — an unprecedented snub of a key Middle East ally.

Then, the Israeli-Palestinian conflict erupted again. Sissi seized an opportunity.

Egypt is one of the only regional powers that has close contacts with both the Israelis and Hamas, the militant group governing Gaza, relationships nurtured carefully over the years.

On Thursday, Israel and Hamas agreed to a cease-fire that Egypt had a key role in brokering.

For many analysts and diplomats, the only clear winner of the latest conflagration between Israelis and Palestinians appeared to be Sissi.

“Facing statements about the declining importance of Egypt in Middle East politics, President Sissi has shown that Egypt and he himself are important,” said Mustafa Kamel el-Sayed, a political science professor at Cairo University. “He demonstrated to the U.S. that he could be an effective actor on the Middle East scene.”

Some U.S. lawmakers have called for cuts to the $1.3 billion in annual military assistance to Egypt, seeking greater pressure for human rights improvements. Egypt’s hand in the truce could shift the narrative in Washington, analysts said.

 After the cease-fire announcement, Biden expressed his “sincere gratitude” to Sissi and his mediation team for playing “such a critical role in this diplomacy.” Hours earlier, during a phone call, Biden and Sissi agreed to “stay closely in touch,” according to a White House statement.

There was no mention in the statement of any discussion of human rights abuses or clampdowns on political and media freedoms by Sissi’s regime.

In a series of tweets Friday, Sissi expressed his happiness at receiving Biden’s call and thanked him for his role “in the success of the Egyptian cease-fire initiative.”

“This confirms the depth and strength of the strategic relations between Egypt and the United States,” tweeted Sissi, saying he hopes for more cooperation.

Other European and regional leaders also called Sissi in appreciation — a nod to Egypt’s decades-old position as a stabilizing force in the Middle East even as Sissi’s regime is widely considered the most repressive in Egypt’s modern history.

“I believe the only real winner of this round of violence was Egypt and its president [Sissi] who got a call long awaited for,” tweeted Mohamed Elmenshawy, a columnist for the Egyptian daily Al Shorouk News, referring to the conversation with Biden. “All other parties ended up winning nothing.”

Regionally, the successful mediation has boosted Egypt’s standing at a time when it has been overshadowed by rivals such as Saudi Arabia, the United Arab Emirates, Turkey and even Russia.

At home, Sissi’s loyalists used social media to praise him for his leadership and for championing the cause of the Palestinian people. It’s crucial support at a time when Sissi has been widely criticized for bulldozing neighborhoods as part of massive infrastructure projects — including a new administrative capital — and doing little to alleviate the country’s immense poverty.

“We are so proud of our president,” tweeted Sara Atlam, a Cairo tour guide.

Between 1948 and 1973, Egypt fought four wars with Israel. But under Sissi, the relationship between Egypt and Israel has deepened. The countries, which signed a peace treaty in 1979, have worked closely on political, economic and security issues. In 2016, Egypt, Israel and Hamas formed an unlikely alliance to confront the Islamic State affiliate in Egypt’s lawless northern Sinai on the border with Gaza, according to Egyptian and Israeli officials.

At the same time, Egypt kept its links with Hamas for pragmatic reasons. Hamas was founded in 1987 as an offshoot of the Muslim Brotherhood, a political Islamic movement whose leader, Mohamed Morsi, was elected president in 2012 following Egypt’s Arab Spring revolts. A year later, Sissi led a military coup that ousted Morsi and outlawed the Brotherhood.

Hamas then ended its ties with the Muslim Brotherhood, in part to appease Egypt and other Arab nations fearful of Islamist challenges to their own leadership.

Egypt has also been able to apply pressure on Hamas through its control of its border with the Gaza Strip. Egypt was called on to mediate between Israel and Hamas to reach cease-fires in their past three wars.

This time, Egypt dispatched mediators to both sides, and Sissi himself got involved in a trilateral meeting with French President Emmanuel Macron and Jordanian King Abdullah II earlier this week.

While the full terms of the pact are unclear, Egypt said it would send two security delegations to Israel and Gaza to monitor the cease-fire and its implementation.

Sissi vowed to give $500 million to reconstruct Gaza and allowed injured Palestinians to enter Egypt through the closed Rafah border crossing to receive medical treatment. The pledges were trumpeted by Egypt’s government-controlled media to bolster Sissi and his commitment to the Palestinian cause.

“Egypt’s nonstop support to Palestine,” blared a headline in Egypt Today, a state-run magazine, with a patriotic image of Sissi’s face flanked by the Egyptian flag.  On Friday, the hashtag “#Sissi Saves the People of Gaza” was trending in Egypt.

“By getting the cease-fire, Sissi shows that he is in line with sentiments of the Egyptian people,” said Sayed.

The message reflects Sissi’s challenge: maintaining a partnership with Israel even though Egyptians are among the Arab world’s most anti-Israel populations.

Any ties with the Jewish state are framed as a betrayal of the Palestinian cause, even in the public rhetoric of some pro-Sissi television and media personalities. On social media, Egyptians have denounced recent normalizations with Israel by the United Arab Emirates, Bahrain, Sudan and Morocco under Trump administration initiatives.

Even seemingly minor decisions are grounds for outrage in Egypt.

In November, Egyptians took to social media to angrily condemn two popular singers — an Israeli and an Egyptian — who took a photo with each other that went viral. The Egyptian theatrical union banned the Egyptian crooner from acting and singing in the country, saying he had tarnished Egypt’s image.

But pro-Palestinian rallies in Egypt are banned by Sissi’s government. And it has targeted supporters of Palestinian causes, including activist Ramy Shaath, who has been imprisoned for two years without due process, and more recently arrested a doctor treating wounded Palestinians in Sinai.

Activists also note that Sissi — despite state media plaudits for his Palestinian sympathies — still participates with Israel in a blockade of Gaza that is suffocating the territory’s economy. And the reconstruction aid Sissi has offered is probably for patronage, said Seth Binder, advocacy director for the Project on Middle East Democracy.

“President Sissi presents himself as a supporter of Palestinians,” said Binder, “but in arresting those who have advocated for Palestinian rights or shown solidarity in recent days . . . the regime shows its true authoritarian colors and the little care it actually has for Palestinians.”