A delegation of senior officials from the Palestinian group Hamas attended the swearing-in ceremony of Iranian President Hassan Rouhani last weekend and later met with Foreign Minister Mohammad Javad Zarif. Hamas now speaks of “a new page” in its bilateral relations with Tehran.

For many years, Iran was considered one of the main supporters of Hamas, which is considered a terrorist organization by the United States and European Union.

Tehran provided the radical group with funds, and weapons, as well as military know-how and training. But with Syria’s civil war, Iran started to back Syrian President Bashar al-Assad, an Alawite Shi’ite, while Hamas sided with the Sunni rebels fighting the Syrian regime.

As a result, Iran cut off military aid to Hamas, and Hamas leader Khalid Mashaal was forced to move his office from Damascus to Qatar’s capital, Doha. He tried to approach Saudi Arabia and traveled to Riyadh in 2015.

However, the recent crisis between Qatar and four other Arab states reshuffled alliances in the region.

In June, Saudi Arabia, the United Arab Emirates, Bahrain, and Egypt accused Qatar of supporting terrorism and imposed sanctions on the tiny Persian Gulf state.

They demanded the Qatari government, among other things, slash ties with Iran and Hamas. But the sanctions had the opposite effect. Iran seized the opportunity and sent shipments of food to Doha, filling Qatari supermarkets with Iranian products.

These events also gave Hamas a reason to try for rapprochement with Tehran.

After the Hamas delegation’s visit to Tehran, the organization issued a statement.

“The visit has opened a new page in our bilateral relations with Iran aimed at confronting the common enemy and supporting Palestine, the Al-Aksa Mosque, and the resistance [against Israeli occupation]”.

The statement also quoted Zarif as saying Iran intended to “maintain relations with the Palestinian factions, led by Hamas, and maintain its support for the Palestinian resistance.”

Iran had already signaled its willingness to re-establish ties with Hamas following the election of Ismail Haniya as the new leader of the organization in May.

A day after U.S. President Donald Trump visited Israel, the head of the Islamic Revolutionary Guards Corps’ elite Quds Force, Qassem Soleimani, congratulated Haniya on his election. He asked him to resolve the internal crisis of his organization wisely.

“We hope you continue your efforts until the liberation of the Al-Aqsa Mosque and the entire Palestinian territory by the hand of Palestinian heroes, so Jerusalem, as in the past, becomes the gathering place for Muslims and Christians.”

International observers had interpreted the election of Haniya -- considered a pragmatic figure -- as an effort to end Hamas’ international isolation, but the political crisis among Arab countries seems to have changed the dynamic of those developments.