President Barack Obama says the US "will not hesitate" to use force to stop Iran obtaining nuclear weapons, but says diplomacy could still succeed.
Addressing an influential pro-Israel lobby group, Mr Obama also warned against "loose talk" of war in the dispute with Tehran.
Earlier, Israeli President Shimon Peres said Iran was "a danger to the world".
The US and its allies suspect Iran of trying to develop nuclear weapons, a claim Tehran denies.
As tension in the region rises, speculation has been mounting that Israel might launch a pre-emptive strike against Iranian nuclear sites.
"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," Mr Obama told the annual American-Israel Public Affairs Committee (Aipac) policy conference in Washington.
"And as I've made clear time and again during the course of my presidency, I will not hesitate to use force when it is necessary to defend the United States and its interests."
However, he said Iran was isolated and there was an opportunity "for diplomacy - backed by pressure - to succeed".
"Already, there is too much loose talk of war," Mr Obama added.
"Over the last few weeks such talk has only benefited the Iranian government, by driving up the price of oil which they depend upon to fund their nuclear programme."
Mr Peres described Iran as "an evil, cruel and morally corrupt regime" bent on controlling the Middle East.
He told delegates: "Iran is the centre, the sponsor, the financier of world terror. Iran is a danger to the entire world."
Mr Obama is due to hold talks with Israeli Prime Minister Benjamin Netanyahu at the White House on Monday.
The US has recently tightened its sanctions against Iran, imposing sanctions on the country's central bank and against three oil companies that trade with Iran.
The European Union has also adopted an oil embargo against Iran.
Tehran insists its nuclear programme is for peaceful ends.