U.S. President Barack Obama says, failing a diplomatic solution, America “will do what we must to prevent Iran from obtaining a nuclear weapon."

In his address to the United Nations General Assembly Tuesday morning, Obama was firm in his comments on Iran's suspected desire to develop its own nuclear weapons capability.

Countries are free to access peaceful nuclear power, he said, but not to put the technology to a violent purpose.

"Make no mistake a nuclear armed Iran is not a challenge that can be contained," Obama said, expressing his desire to find a diplomatic solution.

"We believe that there is still time and space to do so. But that time is not unlimited," he said, warning the consequences of a nuclear-armed Iran could include the unravelling of global arms control agreements and the elimination of Israel.

"And that is why the United States will do what we must to prevent Iran from obtaining a nuclear weapon."

In his remarks Obama also broached the ongoing conflict in Syria, telling the UN that he is committed to finding a diplomatic solution there too.

But Obama began his speech by singling out the contributions of Chris Stevens, the U.S. ambassador killed in a mob assault on the American diplomatic mission in Benghazi, Libya.

Obama said protests in the weeks since Stevens' death, propelled by angry reaction to an anti-Islam video produced in the U.S., amount to attacks on America.

But more than that, he called the often violent protests "an assault on the very ideals upon which the United Nations was founded."

In order to protect those principles, Obama urged world leaders gathered at the UN in New York to commit to addressing the "deeper causes of this crisis.

"Because we face a choice between the forces that would drive us apart, and the hopes we hold in common," he said.

"Today, we must affirm that our future will be determined by people like Chris Stevens, and not by his killers. Today, we must declare that this violence and intolerance has no place among our United Nations."

Freedom and self-determination, he said, are not just American values.

"These are human values," he continued, highlighting a list of nations undergoing political changes such as Burma and Tunisia, heralding this as a "season of progress."

Tuesday's address was Obama's final scheduled speech to international leaders ahead of the U.S. presidential election on Nov. 6.

Republican presidential nominee Mitt Romney set Obama's speech in the campaign context Monday, when he blasted the Democratic hopeful on his foreign policy.

"This is time for a president who will shape events in the Middle East, not just be merciful or be at the mercy of the events," Romney said, ridiculing Obama for suggesting countries transformed during the Arab Spring uprisings face "bumps in the road."

Obama steered clear of any reference to his political rival at the UN Tuesday, but his whirlwind schedule makes clear the president is in full campaign mode as well.

Instead of the days of one-on-one meetings the U.S. president normally holds when the UN convenes, Obama is spending just 24 hours in New York City.