Egypt's decision to build an underground metal wall along its border with the Gaza Strip has triggered a crisis between Cairo and Hamas.
Moreover, Hamas believes that Mubarak is also seeking "revenge" because the movement has preferred German mediation to Egyptian involvement in the negotiations with Israel over the release of IDF soldier Gilad Schalit.
In both cases, Mubarak felt humiliated by Hamas's actions.
In assuming the role of mediator between Hamas and Fatah, Mubarak was hoping to succeed where other Arabs, specifically the Saudis, Yeminis and Qataris, had failed.
Just when the two sides appeared to be on the verge of signing a "reconciliation agreement" under the auspices of the Egyptians last October, Hamas bolted. Hamas justified its decision to stay away from the signing ceremony by citing Palestinian Authority President Mahmoud Abbas's failure to support a resolution at the United Nations in favor of the Goldstone Report into Operation Cast Lead.
Hamas's decision not to sign the accord with Fatah was seen by Palestinians and Egyptians as a severe blow to Mubarak's personal prestige and Egypt's standing in the Arab world. Mubarak was hoping that the agreement would help Egypt restore its long-lost status as one of the most influential Arab countries.
On the personal level, he was hoping that success in resolving the Hamas-Fatah crisis would reaffirm his standing as a powerful and historic leader, thus improving the prospects of his son, Jamal, to succeed him.
Similarly, Mubarak was hoping that a prisoner-exchange agreement between Hamas and Israel would be achieved through Egyptian mediation. But in recent weeks he has been forced to see Hamas dump Egyptian negotiators in favor of German security officials.
Some Hamas representatives have openly chastised Mubarak's negotiators for being "biased" in favor of Israel. In other words, Hamas is telling the world that it trusts the Germans more than it trusts its Muslim brothers in Egypt.
Relations between Hamas and Cairo have been tense ever since the movement took full control of the Gaza Strip in June 2007. Since then, the Egyptians have done almost everything to isolate and weaken the Hamas government in the Gaza Strip. This includes the continued closure of the Rafah border crossing and other restrictions imposed by Egyptian authorities.
The Egyptians' main concern is that Hamas would "export" its radical ideology to Egypt.
Reports about increased cooperation between Hamas militiamen and Egyptian smugglers and members of other Islamic fundamentalist groups in Sinai have prompted the Egyptian security forces to beef up their presence in the area.
Tensions between Hamas and Cairo reached their peak last month with the death of a Hamas operative in an Egyptian prison. The victim was the brother of Hamas spokesman Sami Abu Zuhri.
Hamas rushed to accuse the Egyptian General Intelligence Service of torturing the man to death. The allegation was broadcast on many Arab satellite TV stations, seriously embarrassing Mubarak, whose spokesmen have since been struggling to convince Arab and Muslim viewers that the Hamas man died of natural causes.
Over the past few days, Hamas militiamen have opened fire several times on Egyptian border policemen and laborers who are involved in the construction of the metal wall. The shooting incidents have also escalated tensions between the Hamas leadership and Cairo.
An all-out confrontation between Hamas and Egypt will undoubtedly undermine Mubarak, because it will make him appear as if he's helping Israel and the US in their war against the movement. A confrontation will also send the message that Mubarak is also involved in the "siege" on the Gaza Strip.
Hamas, on the other hand, stands to win from a standoff with a regime that is regarded by many Arabs and Muslims as a puppet in the hands of the Israelis and Americans.
And any victory for Hamas is also a victory for Damascus and Teheran.