TEHRAN - Islamist militant groups will fight alongside Iran if the country is attacked by Israel, exiled Hamas leader Khaled Meshaal said on Tuesday.

Israel has not ruled out military action against Iran if diplomacy fails to end a dispute over Tehran's nuclear programme, which the United States and its allies suspect is aimed at building an atomic bomb. Iran denies such an ambition, saying it wants to generate electricity using nuclear power.

All Islamist militant groups will form a united front with Iran against Israel if it attacks Iran, Meshaal, visiting Iran, told a news conference broadcast live on state television.

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.

Israeli officials have warned they could try to destroy Iran's nuclear facilities in the same way that Israel bombed Iraq's Osiraq nuclear reactor in 1981.

Iran has said it will retaliate if attacked, and security analysts believe it would mobilise militant allies such as Palestinian Hamas and Lebanese Hezbollah in its response.

Meshaal said Israel was a danger for the Middle East region. God willing, a regional resistance has the capacity to confront this danger, Meshaal said.

Israeli and U.S. officials have accused Iran of providing weapons, cash and training to Hamas and another Palestinian group, Islamic Jihad. Iran insists it only gives them moral and political support.

TERROR ORGANISATION
A senior Israeli general said on Tuesday that Hamas and Hezbollah were expanding their rocket reach as part of their alliance with Iran, which refuses to recognise Israel.

Syria, Iran and Hezbollah is the only terror organisation in the world that possesses surface-to-surface missiles and has the ability to threaten the greater Tel Aviv area, said Major- General Amos Yadlin, chief of Israeli military intelligence.

And recently, Hamas has been trying to achieve the same abilities.

Israel cites Iranian President Mahmoud Ahmadinejad's repeated calls for the destruction of the Jewish state as a clear sign that Iranian nuclear weapons, if it acquires them, would threaten the country's existence.

Iranian Supreme Leader Ayatollah Ali Khamenei said Iran had no intention to end its support for Islamist guerrilla groups.

Supporting Palestinians is our religious and national duty. We will continue our support and will never give it up, he said at a meeting with Meshaal, state television reported.

Meshaal praised Iran for backing Hamas, which 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.

(Editing by Mark Trevelyan)