US President Donald Trump has told the UN General Assembly that America would destroy North Korea if forced to defend itself or its allies.
In his debut speech, he mocked North Korea's leader, Kim Jong-un, saying: "Rocket man is on a suicide mission."
North Korea has tested nuclear bombs and missiles in defiance of the UN.
Just before Mr Trump spoke, UN Secretary General Antonio Guterres had urged statesmanship, saying: "We must not sleepwalk our way into war."
The American leader also attacked Iran, saying it was a "corrupt dictatorship" intent on destabilising the Middle East.
He called on the government in Tehran to cease supporting terrorism and again criticised the Obama-era international agreement over Iran's nuclear programme, which he called an embarrassment.
In his own debut speech, French President Emmanuel Macron strongly defended the Paris climate accord, signed in the same room in New York two years ago and rejected in June by Mr Trump, to widespread international dismay.
The General Assembly, which continues until Monday, is an annual event, bringing together leaders of the UN's 193 member states.
In other parts of Mr Trump's speech he:
- said the US could "no longer be taken advantage of or enter one-sided deals"
- said the crisis in Venezuela, which is led by a leftwing government hostile to the US, was "unacceptable" and America could not "stand by and watch"
- denounced socialism as an ideology, saying it had only brought "anguish and devastation and failure"
- condemned "uncontrolled migration" but insisted America was a "compassionate nation" which had spent billions of dollars on helping refugees return to their home countries
'No choice but to totally destroy'
Washington has repeatedly warned North Korea over its weapons tests, which violate UN Security Council resolutions.
The crisis worsened last month when the North announced plans to test missiles around the US Pacific territory of Guam.
"If [the US] is forced to defend itself or its allies, we will have no choice but to totally destroy North Korea," Mr Trump said.
President Trump's threat to "totally destroy" North Korea is implausible, according to Stewart Patrick, a senior fellow at the Council on Foreign Relations, a New York think tank.
"I think the folks in the Pentagon when they look at military options are just aghast at the potential loss of life that could occur with at a minimum hundreds of thousands of South Koreans killed in Seoul," he told the BBC.
By Jonathan Marcus, BBC News
President Trump's speech was an eloquent exposition of his "America First" doctrine but at the same time contained some fulsome (and perhaps unexpected) praise for the United Nations as a body that can bring together sovereign states to tackle the world's problems.
In contrast to the focus on globalisation that has driven so much of foreign policy discussion since the 1990s, Mr Trump saw national sovereignty as the main pillar of the international system. There was a nod to the old axis of evil theme.
He opposed "the righteous many" to "the wicked few", with his rogues' gallery taking in a predictable cast of North Korea, Iran and Venezuela.
Nonetheless Mr Trump's world view contained many contradictions. Where exactly is the boundary between national sovereignty and collective action? And does America's newfound foreign policy pragmatism extend just to calling for the return of democracy in Iran and Venezuela or actually for doing something practical about it?
The 2015 deal between Iran, the US and other world powers, including China and Russia, was designed to prevent Iran developing a nuclear weapon.
"Frankly, that deal is an embarrassment to the United States, and I don't think you've heard the last of it," Mr Trump told the General Assembly on Tuesday.
Iran's government, he said, was bent on "death and destruction", while its people wanted change.
Iranian Foreign Minister Javad Zarif commented on Twitter that "Trump's ignorant hate speech" belonged "in medieval times - not the 21st Century UN".
Trump's ignorant hate speech belongs in medieval times-not the 21st Century UN -unworthy of a reply. Fake empathy for Iranians fools no one.— Javad Zarif (@JZarif) September 19, 2017
Using almost biblical language, the American leader portrayed the world in terms of "decent nations" confronted with "rogue regimes".
"If the righteous many do not confront the wicked few then evil will triumph," he said in the speech.
"When decent people and nations become bystanders to history the forces of destruction only gather power and strength."
The General Assembly was opened by Mr Guterres, who said that millions of people were living in dread as a result of North Korea's nuclear and missile tests.
"The use of nuclear weapons should be unthinkable," he said. "But today global anxieties about nuclear weapons are at the highest level since the end of the Cold War."
The former head of the UN refugee agency also spoke of being "pained to see the way refugees and migrants have been stereotyped and scapegoated - and to see political figures stoke resentment in search of electoral gain".
According to Reuters news agency, when Mr Trump made his remarks about destroying North Korea, one man in the audience covered his face with his hands, while Swedish Foreign Minister Margot Wallstrom crossed her arms.
Loud, startled murmurs filled the hall, according to the agency.
In his speech, President Macron said climate change was starting to take revenge on man, and extreme weather events would erase the differences between rich and poor countries.
He promised an extra €5bn ($6bn; £4.4bn) of French investment to fight climate change.
The French leader also defended the nuclear deal with Iran. "Renouncing it would be a grave error," he said.
Israeli Prime Minister Benjamin Netanyahu sided with Mr Trump in his speech, saying the deal with Iran should be amended or scrapped altogether, and warned against the spread of Iranian influence in the Middle East.
Turkish President Recep Tayyip Erdogan used his speech to urge the Iraqi government to stop the Kurdistan Regional Government holding a referendum on independence on 25 September.