Over the past three years, Egyptian President Hosni Mubarak and Palestinian Authority President Mahmoud Abbas have made almost every effort to undermine Hamas. Lately, however, their actions have shown that they are actually helping to legitimize the terrorist organization and turn it into a significant player in the region. A review of the situation until a few weeks ago is in order. Mubarak kept the Rafah border crossing with the Gaza Strip closed, with the hope that the economic crisis would prompt the Palestinians there to revolt against Hamas. Mubarak also imposed severe restrictions on the movement of Hamas leaders, by banning many of them from using the Rafah terminal to travel to other countries. During and after Operation Cast Lead, the Egyptians toughened their security measures, preventing medical teams and aid convoys from the Arab world from entering Gaza. And some Egyptians who managed to infiltrate the Strip - to express their solidarity with Hamas and the Palestinians living there - have been arrested by Mubarak's security forces. Egyptian-German blogger Philip Rizk, who tried to organize a protest against the continued closure of the Rafah border crossing, was arrested for several days, and prevented from seeing a lawyer or family members. Wounded Palestinians who were transferred to Egyptian hospitals for medical treatment reported that they had been interrogated by Egyptian security officers about their alleged relations with Hamas. Many said that the Egyptians also barred members of their families from accompanying them to Egypt "for security reasons." Abbas, for his part, used the military offensive in Gaza as a pretext for stepping up his crackdown on Hamas and its supporters in the West Bank. More than 500 Palestinians have been rounded up by Abbas's security forces in the past two months, on suspicion of membership in Hamas or for voicing public support for the movement. Abbas's US-trained policemen also used an iron-fist policy against Palestinians who took to the streets to protest against the war and express their solidarity with their brothers in Gaza. In many cases, Palestinians were forbidden to demonstrate, unless they agreed to shout slogans in favor of Abbas and his Fatah faction. Abbas's media also joined the effort by waging a propaganda campaign aimed at discrediting Hamas in the eyes of the Palestinian public. Ramallah-based newspapers and Web sites were full of stories that sought to depict Hamas leaders as corrupt and cowardly. One report, for example, claimed that Hamas's top operative, Mahmoud Zahar, had fled to Egypt in an ambulance belonging to the Palestinian Red Crescent. Another report talked about how Hamas leader Khaled Mashaal and his colleagues in Syria were staying at five-star hotels in some of the Gulf countries, while their people in Gaza were under attacks by Israel. It's no secret that both Mubarak and Abbas would have preferred to see the war end in a different way - namely, with the removal of Hamas from power. The two, who regard Hamas as a threat to their regimes, were hoping that Israel would "finish the job," and get rid of Hamas for once and for all. Mubarak is afraid of Hamas because of its affiliation with the Muslim Brotherhood - one of the largest opposition groups in Egypt. An Egyptian newspaper editor who is affiliated with Mubarak's government wrote last week that Cairo was determined to prevent Hamas and the Muslim Brotherhood from establishing a Taliban-style regime in the Middle East. Abbas is worried because Hamas has never abandoned its desire to topple his government in the West Bank. During Operation Cast Lead, Mashaal and other Hamas leaders urged the West Bank Palestinians to revolt against Abbas, whom they accused of "collusion" with Israel. BUT THE trend in Ramallah and Cairo appears to be changing. The fact that Hamas remains in power, despite the severe military blows it was dealt by Israel, has prompted Abbas and Mubarak to endorse a different strategy toward the movement. Instead of seeking to weaken or topple Hamas, the two are now following the saying: "If you can't beat 'em, join 'em." Almost immediately after the war ended, Abbas instructed his top aides to launch reconciliation talks with Hamas, in a bid to explore the possibility of forming a joint Hamas-Fatah government. His decision to engage Hamas is the direct result of the departure of the administration of former US president George W. Bush, who was strongly opposed to any form of dialogue between Fatah and Hamas. However, with the arrival of President Barack Obama, Abbas feels confident that he can talk to Hamas without having to worry about receiving angry phone calls from the White House or the State Department. Like many Palestinians, Abbas is aware of the fact that Hamas has emerged from the war with a political victory, due to the massive support it enjoys among the Arab and Muslim masses. Even some of Abbas's top advisers have admitted in private that Hamas is today stronger than it was before the war, because of the sympathy and support it has won. Abbas is hoping that the rapprochement with Hamas would improve his image among the Palestinians, and divert attention from his own problems at home, particularly in the face of growing criticism inside Fatah over his failure to reform the faction and pave the way for the emergence of a young leadership. In the context of his efforts to patch up his differences with Hamas, Abbas flew on Thursday to Qatar, the oil-rich emirate that has long been supporting Hamas financially and politically. As for Mubarak, he has instructed his General Intelligence Service to invite Hamas leaders to Cairo, in an attempt to persuade them to agree to a new cease-fire and a prisoner exchange with Israel. The Hamas officials are being welcomed in the Egyptian capital as VIPs - a factor that has earned them additional respect and legitimacy in the eyes of many Arabs and Muslims. By courting Hamas and pleading with it to accept their demands, Abbas and Mubarak are, in fact, further boosting the movement's standing. Ironically, this is being done at the expense of their own credibility. The two leaders are convinced that the key to the stability of their regimes is now in the hands of Mashaal and his patrons in Tehran.