When Iraq hung Saddam Hussein, furious Sunni Muslims in the militant group Hamas held mourning ceremonies. That did not sit well with Shi'ite Muslim Iran, one of Hamas' key backers but also a strong Saddam foe. Yet the dispute over Saddam's execution did not break the Hamas-Iran alliance, either. Instead the two - bound by common strategic interests - have solidified their relationship in the last year, creating a growing worry for both some Arab countries and for Israel. Israel has in recent weeks accused Iran of training Hamas militants from Gaza and smuggling weapons to Hamas. The weekend formation of a Palestinian coalition government between Hamas, which won a democratic election a year ago, and the more moderate Fatah is sure to bring new attention to the issue. At their core, Iran and Hamas are far apart ideologically: Iran espouses a fundamentalist Shiite version of Islam, while Hamas adheres to an equally strict rival Sunni version. But when it comes to Hamas, Iran's interests are based primarily on its rivalry with Washington and with its Arab allies for influence in the region. "Political Islam is very pragmatic," said Beirut-based Palestinian analyst Souheil Natour. "They are playing realpolitick." Iranian analyst Saeid Leylaz said Iran's strategic goals are based on its perception that the United States is a threat to its survival. "The Iranians are trying to use all the means at their disposal to cripple American efforts ... If Iran and America sit down at the negotiating table and discuss their strategies, I promise you that all Iran's actions in the Middle East, including Palestine, will change," he said. Iran rushed to the aid of Hamas last year after most Arab states went along with an international boycott against the Hamas government, imposed by the US and Europe because of Hamas' refusal to recognize Israel or renounce violence. At first, Iran pledged US $50 million to the near-bankrupt Palestinian Authority. Since then, it is believed to have promised another US $250 million to be paid in monthly installments. After the Palestinian coalition government's formation, however, some Western governments, including key donor Norway, are likely to resume payments to the Palestinians, which could lessen the need or desire for Iranian aid. Meanwhile, Arab states - worried about Iran's growing regional influence _ have in recent months tried to blunt Iran's role by reaching out to Hamas. Last month, Saudi King Abdullah mediated a truce in the bloody fighting between Hamas and President Mahmoud Abbas' Fatah movement at a summit in Mecca, and persuaded them to agree on forming the Palestinian unity government. Hamas viewed the Mecca meeting as a sign of its reintegration into Arab politics. "It was a recognition of the election results and (Arab) cooperation with Hamas," said Mousa Abu Marzouk, a Hamas spokesman in Damascus. But the Mecca meeting did not mean Hamas would abandon Iran as an ally, either, he said. "Ties remain strong with Iran," Abu Marzouk said. "Iran's position is the closest to Hamas." Indeed, relations between the two were tight even before Hamas' election win. Iran and Hamas forged a united front against Israel during Hamas leader Khaled Mashaal's visit to Tehran in December 2005, when Mashaal pledged to step up attacks against Israel if it took military action against Iran. "We are part of a united front against the enemies of Islam," Mashaal said then. The position contrasts that of the moderate Fatah faction, who regard Arab states such as Egypt and Saudi Arabia as the Palestinians' natural allies. The ties between Iran and Hamas first began in the early 1990s when Israel expelled 400 Hamas and Islamic Jihad operatives to southern Lebanon. The exiled Palestinians camped out in Marj al-Zohour, a no-man's land controlled by Iranian-backed Hezbollah, a Shiite Lebanese guerrilla group. Before that, Hamas had been wary of Shiite Iran but ties gradually warmed. "The psychological taboo against Shiism was broken in Marj al-Zohour, where the Palestinians came into close contact with Hezbollah and actually got along," said Sakr Abu Fakher, editor of the Palestinian Studies magazine in Beirut. Ties strengthened and financial support grew after the 2000 Palestinian uprising against Israel. A historic visit to Tehran in 1998 by Hamas' late spiritual leader, Ahmed Yassin, also helped. After Syria, Teheran's closest Arab ally, became the main base for senior Hamas exiles in 1999, the contacts between Iran and Hamas increased even more. Yet Hamas "has never considered itself as part of the Syria-Iran axis, as Hezbollah has," said Beirut-based Palestinian expert Majed Azzam. He and others note that Hamas has taken independent positions from Tehran, such as when it participated in the 2006 Palestinian elections against Iran's objections. In addition, he said, Hamas is not prepared to take a "hostile position against other Arab countries, even against those that have peace treaties with Israel."