Hamas politburo chief Khaled Mashaal said on Tuesday that Islamist militant groups would back Iran if the country was attacked by Israel, Iranian state television reported.
"All Islamist militant groups will form a united front with Iran against Israel if it attacks Iran," Mashaal told a news conference in Tehran.
"We are all parts of the same body ... We all should fight against the mutual enemy. But how, the leaders will decide based on our capacities."
Israel has said it was readying all options to try to force Iran to halt its atomic program, which the West fears is a cover to build nuclear bombs. Iran denies the charge.
Mashaal said Israel was a danger for the Middle East region.
"God willing a regional resistance has the capacity to confront this danger," Mashaal said in the televised news conference.
Hamas won a Palestinian parliamentary election in 2006, defeating the once-dominant, more secular Fatah faction, and drove Fatah out of the Gaza Strip the following year.
Addressing the negotiations on a possible prisoner exchange agreement between Israel and Hamas, Mashaal said Israel has yet to meet the Islamist group's demands.
"The Shalit deal will not materialize until Israel meets our demands," he said. "These demands are known to the German mediator."
On Sunday Iranian President Mahmoud Ahmadinejad advised Mashaal to wait on concluding the prisoner exchange deal with Israel, until it includes the maximum number of Palestinian prisoners to be released, according to Gaza-based news agency Qudsnet.
Qudsnet quoted Iranian media sources close to the government as saying that Mashaal updated Ahmadinejad with the latest developments during their meeting in Tehran.
The sources further claimed Mashaal told Ahmadinejad the deal will include the release of Syrian prisoners, most likely referring to Druze residents of the Golan Heights, in exchange for captive IDF soldier Gilad Shalit.