BEIRUT Iran can be fairly content with the outcome of Israel's devastating assault on the Gaza Strip.
Its Hamas allies emerged bloodied but unbowed, it gained a foothold in Arab decision-making and its calls for resistance to Israel chimed better with Arab popular sentiment than attempts by Egypt to minimize any benefits for the Palestinian Islamists.
Tehran, which rearmed Hezbollah Shi'ite guerrillas and sent them hundreds of millions of dollars for reconstruction after Israel's 2006 war in Lebanon, will find it harder to replenish Hamas's arsenal or finance rebuilding in the Gaza Strip.
The tiny coastal enclave's borders with Israel and Egypt are officially sealed. Both countries are hostile to Iran and, in differing degrees, to Gaza's Islamist rulers.
But the Iranians will still be satisfied with the returns they have made on a relatively limited investment, analysts say.
"In the waning days of the Bush administration, what did we see? Not an Israeli or American bombing run on Iranian nuclear facilities, but the strengthening of Iran's position on Israel's doorstep," said Mouin Rabbani, contributing editor to Middle East Report. "Why complain if you are sitting in Tehran?"
With the Gaza struggle now moving to reconstruction, Israel is determined to deny Hamas any post-war political gains, while the West wants to use aid money to carve out a revived role for President Mahmoud Abbas's Palestinian Authority in the strip.
The Islamist movement pledged on Thursday to distribute up to 4,000 euros ($5,180) to Gazan families hit by the Israeli conflict -- a vow that recalled the way Hezbollah enhanced its reputation at the expense of the Western-backed Lebanese government by handing out cash to victims of the 2006 war.
Iran has expanded ties with Hamas in recent years, despite religious differences with a group spawned by the Sunni Muslim Brotherhood, sending it money through tunnels beneath the Gaza Strip's border with Egypt and training its fighters.
Israeli and Hamas sources say scores of militants had received training in Iran before Israel's 22-day Gaza onslaught.
Hamas and other Palestinian groups have mostly fired crude homemade rockets into Israel, but Israeli officials say Iran has also supplied Hamas with longer-range Katyusha or Grad missiles, similar to those used by Hezbollah, an ally of Iran and Syria.
An Israeli intelligence official, who declined to be named, said last week that Hamas Grads were made in China, bought by Iran and smuggled into the Sinai via the Red Sea or Sudan.
The Israelis contend that Iranian weapons are also smuggled via the Suez Canal to an Egyptian Mediterranean port where they are reloaded onto small fishing boats. These try to run Israel's naval blockade of Gaza, dropping the arms in special submersible containers that are retrieved by Palestinian divers.
A Western diplomat in Tehran said the extent of Iranian arms supplies to Hamas was not clear, but added: "My understanding is that most of the things fired from Gaza were made in Gaza."
Iran and Hamas have a common enemy in Israel, but remain an "odd couple," he said, unlike Tehran's deep ties to Hezbollah.
"They have no ideological affinity whatsoever. It's a pure marriage of convenience," the diplomat said, identifying Islamic Jihad, not Hamas, as Iran's original Palestinian soulmate.
Rabbani said Iran would only have been disappointed in the Gaza conflict if Israel had won an unambiguous victory or if the political outcome had been adverse to Iran and its allies.
"If anything, it has been the opposite," he said, arguing that Hamas had been bolstered politically, while Abbas, whose forces were driven from Gaza in 2007, had been fatally weakened.
Despite killing some 1,300 Palestinians and blazing a trail of destruction, Israel failed to achieve the decisive military triumph that its leaders have claimed, said Alastair Crooke, a former European Union negotiator in the Middle East.
"It was a war of ghosts," he said, adding that Hamas had preserved much of its combat capacity by avoiding direct confrontation with Israel's vastly superior forces and had projected a defiant image of psychological strength.
"Israel feels that when Hamas sees the devastation of Gaza, it will emerge contrite, docile and deterred," Crooke said.
"But Hamas did not emerge in their underpants waving white flags. There were no images of defeat. I imagine Iran is not dissatisfied with the political or even the military outcome."
Midway through the conflict, Iran's Supreme Leader Ayatollah Ali Khamenei flayed some Muslim governments for doing too little to halt Israel's attack, saying this would expose them to future humiliation -- a message that resonated with the Arab street.
Iran, a non-Arab observer, won a respectful hearing at a meeting on Gaza in Qatar where Syria and Hamas joined its calls for Arab states to cut ties with Israel. Egypt and Saudi Arabia, Washington's main Arab allies, stayed away, but Turkey attended.
"It was a striking shift in diplomacy," Crooke said of the Qatar meeting, at which Hamas and other anti-Abbas factions represented the Palestinians, and Syrian President Bashar al-Assad proposed withdrawing an Arab peace offer to Israel.
Rabbani said the Doha meeting showed that Iran had almost become an accepted participant in regional dialogue. "The key players there were not the traditional ones, Cairo and Riyadh, but rather Tehran and Ankara. That was quite telling."
(Additional reporting by Nidal al-Mughrabi in Gaza, Dan Williams in Jerusalem and Edmund Blair in Tehran; Editing by Samia Nakhoul)