Israel and the US have good reason to be worried about Hamas's latest moves, which are likely to have a negative impact on John Kerry's efforts to reach a solution to the Israeli-Palestinian conflict.
In recent weeks, Hamas leaders have been working to restore their relations separately with Iran and the Palestinian Authority.
At first glance, there seems to be a contradiction in Hamas's policy. As the saying goes, "Tell me who your friends are and I'll tell you who you are."
Any rapprochement between Hamas and Iran would mean that the Islamist movement has chosen to throw itself into the arms of Iran, a country that, like Hamas, does not recognize Israel's right to exist and is vehemently opposed to the current U.S.-sponsored peace talks.
At the same time, any rapprochement between Hamas and the Palestinian Authority could be interpreted a sign of "moderation" and "pragmatism" on the part of the Islamist movement. But this interpretation is far from true: Hamas continues to oppose the peace talks and refuses to recognize Israel's right to exist.
So what are Hamas's real motives behind this new policy?
Hamas has been passing through difficult times over the past three years as a result of events in Syria and Egypt.
Hamas's refusal to support Syrian dictator Bashar Assad in his fight against his opponents has damaged its ties with Iran, whose leaders continue to back the Syrian regime.
Hamas received a second blow with the ouster of Egyptian Muslim Brotherhood President Mohamed Morsi seven months ago. Egypt's new rulers view Hamas as an enemy and threat to their national security.
Hamas's growing isolation has prompted its leaders to reconsider their policy. For Hamas, the name of the game these days is survival.
Hamas is desperate for cash and the only two parties that could help rid it of its crisis are Iran and the Palestinian Authority.
Hazem Balousha, a Palestinian journalist based in Gaza City, revealed that prominent figures in the Iranian government have contacted leaders in Hamas to hold meetings, with the goal of healing the rift between the two sides.
This outreach "has led to a series of preliminary understandings that have tentatively revived ties between the two parties once again."
Balousha pointed out that Hamas used to receive $23 million per month from Iran before Tehran cut its ties to the movement in the Gaza Strip. Now, he said, Iran has restored its financial aid to Hamas and part of the funding has reached the Gaza Strip during the past three months.
Hamas leader Mahmoud Zahar confirmed last month that his movement has resumed relations with Iran.
In a surprise move, Hamas announced last week a number of "positive measures" aimed at restoring ties with Mahmoud Abbas and the Palestinian Authority.
Hamas Prime Minister Ismail Haniyeh said that the measures include the release of Fatah prisoners from Hamas jails seven years after Hamas seized control over the area in the summer of 2007, as well as allowing others who fled the Gaza Strip to return to their homes and families.
A few days later, Hamas fulfilled its promise by releasing seven Fatah prisoners.
In response, Fatah announced that it would dispatch its senior representative, Azzam Ahmed, to the Gaza Strip shortly, to pursue efforts to end the dispute with Hamas.
The decision to send Ahmed to the Gaza Strip came after Haniyeh phoned Abbas and expressed his desire to achieve "national unity" between the two rival parties.
Hamas, however, is not chasing Abbas because it supports his policies, including the peace talks with Israel. Nor is Hamas seeking reconciliation with the Palestinian Authority because it has decided to renounce violence and recognize Israel's right to exist.
Hamas remains strongly opposed to any peace talks with Israel, as its leaders continue to declare day and night.
Hamas's representative in Lebanon, Ali Baraka, last week condemned the peace talks as a "scheme to liquidate the Palestinian cause."
Hamas wants unity with the Palestinian Authority not because it wants to boost the peace process, but bring it to a halt.
If Hamas is so strongly opposed to the peace talks, why are its leaders saying that they are prepared to join forces with the Palestinian Authority?
The answer is obvious: Hamas wants the Palestinian Authority to continue channeling funds to the Gaza Strip.
More than half of the Palestinian Authority's annual budget goes to pay salaries and support various projects in the Gaza Strip despite the rivalry between the two sides. Abbas told Jordanian parliamentarians during a meeting in his office that 58% of the Palestinian Authority budget goes to the Gaza Strip.
Hamas's efforts to restore ties with Iran and the Palestinian Authority are nothing but a ploy to ensure its continued presence in power. Hamas is definitely not headed toward any change. Now that it is back on the payroll of Iran, Hamas will feel more confidant than ever to pursue its efforts to foil any agreement between the Palestinian Authority and Israel.