US President Barack Obama warned Iran against its nuclear programme and vowed to use military action to prevent it from using nuclear weapons.

While speaking at the American Israel Public Affairs Committee (AIPAC), the pro-Israel lobby group, on Sunday, President Obama said Iran's nuclear programme is against US and Israel's security interests and urged that the issue be solved diplomatically.

"I have said that when it comes to preventing Iran from obtaining a nuclear weapon, I will take no options off the table, and I mean what I say," he said.

"Iran's leaders should know that I do not have a policy of containment; I have a policy to prevent Iran from obtaining a nuclear weapon.

"I only use force when the time and circumstances demand it. Already, there is too much loose talk of war," he said.

The president also raised concerns that Iran's nuclear weapons might fall into the hands of a terrorist group.

Israel President Shimon Peres, who addressed the AIPAC conference just before Obama's speech, said that Israel shared the same interests as that of the United States.

Israel Prime Minister Netanyahu, who is in Canada, welcomed President Obama's comments.

"I very much appreciate the fact that President Obama reiterated his position that Iran must not be allowed to develop nuclear weapons and that all options are on the table," CBS News quoted Netanyahu as saying.

Mr Obama will be meeting Mr Netanyahu on Monday at the White House to discuss the Iran issue. The prime minister is expected to put pressure on the president to take a harder line on Iran.