NEW YORK — President Trump on Tuesday delivered a toughly worded defense of his "America first" foreign policy in his inaugural address to the United Nations and threatened to "totally destroy" North Korea if necessary.

The president, speaking at the United Nations' hallowed green-marble rostrum, also excoriated the international nuclear deal with Iran as an "embarrassment" and strongly hinted that his administration would soon back out, against the wishes of many nations in the room.

The defiant and pugilistic speech put the General Assembly hall of more than 150 delegations on notice that the United States, under Trump's leadership, is willing to pursue an unpopular and unpredictable course to protect its interests across the globe.

Trump called on world leaders to rally in the fight to defeat murderous regimes and "loser terrorists," and he derisively referred to North Korean dictator Kim Jong Un, who oversees an expanding nuclear arsenal, as "Rocket Man." Reflecting on the United Nations charter of promoting world peace, the president asserted to the room full of diplomats: "Major portions of the world are in conflict, and some, in fact, are going to hell."

"To put it simply," Trump declared, "we meet at a time of both of immense promise and great peril. It is entirely up to us whether we lift the world to new heights or let it fall into a valley of disrepair."

Most of the president's views were well known before he arrived at the annual U.N. gathering. But his 42-minute speech, delivered in a combative tone rare for an American leader, put them in stark relief at a time of widespread anxiety among U.S. allies and partners over the nation's traditional role of world leader.

In contrast to Trump, French President Emmanuel Macron used his own first U.N. address later Tuesday to defend the principle of global cooperation.

"Today, more than ever before, we need multilateralism" to deal with worldwide threats such as climate change and terrorism, Macron said. "We can only address those challenges through multilateralism," he said, "not through survival of the fittest."

Macron, in an interview with CNN, also said the rhetoric toward North Korea should be toned down and warned against abandoning the nuclear deal with Iran.

"Look at the map — if we talk of a military solution, we speak about a lot of victims," he told the network about the tensions on the Korean Peninsula. "Building peace is what we have to do in this region."

If Trump was eager to use his U.N. address to set the terms for his engagement with an international organization that he derided as ineffectual during his presidential campaign, his rhetoric also set up a potentially dangerous test of his administration's credibility to carry out the promises and threats he issued.

The president said the United States has "great strength and patience," but he emphasized that if forced to defend America or its allies, "we will have no choice but to totally destroy North Korea." He said that Kim "is on a suicide mission for himself and for his regime."

Kim, the leader of a nation of 25 million, has responded to past threats from Trump by highlighting hisgovernment's nuclear weapons programand conducting ballistic missile tests. Foreign affairs analysts contend that a U.S. military response would risk sparking a regional conflict that would result in millions of deaths in densely populated South Korea and Japan.

Despite his past criticism of the United Nations — including a 2012 tweet mocking the "cheap" green marble backdrop in the General Assembly hall — Trump extended a hand to fellow leaders and praised those who offered help in the wake of the hurricanes that destroyed areas of Texas, Florida and the U.S. Virgin Islands.

But he also called repeatedly for all nations to embrace sovereignty and self-reliance at a body founded after World War II on the idea that all countries are stronger when they work together.

"As president of the United States, I will always put America first, just like you, as the leaders of your countries, will always, and should always, put your countries first," Trump said, returning to a campaign theme and the "America first" phrase, which has been criticized as isolationist and nationalistic.

Trump, who campaigned as an iconoclast who would speak for a marginalized middle class and focus on domestic priorities, made clear that his administration would not shrink from global challenges, including the escalating economic and political crisis in Venezuela.

At the same time, however, he took care Tuesday to send signals to the mostly white, middle-class voters who form the core of his political support. He took a swipe at "mammoth multinational trade deals" and "powerful global bureaucracies," and he emphasized that "uncontrolled migration is deeply unfair."

"The substantial costs . . . are borne overwhelmingly by low-income citizens whose concerns are often ignored by both media and government," Trump said.

But it was Trump's strong criticism of authoritarian regimes that drew the most reaction in the U.N. assembly hall and on Capitol Hill.

"The goals of the United Nations are to foster peace and promote global cooperation," Sen. Dianne Feinstein (D-Calif.) said. "Today, the president used it as a stage to threaten war."

After the president's address, White House press secretary Sarah Huckabee Sanders sought to temper the idea that Trump's remarks on North Korea represented a break from long-standing U.S. policy. In a tweet, she cited President Barack Obama's U.N. address last year when he said that the United States "could, obviously, destroy North Korea with our arsenals" — though Obama appeared to be stating a fact rather than a step that his administration was considering.

On Iran, Trump called the U.N.-backed nuclear deal "one of the worst and most one-sided" agreements ever. His administration has said that Tehran is violating the spirit if not the letter of the landmark 2015 accord through its alleged support for terrorism and other activities. Iran, the U.N. nuclear watchdog agency and other parties to the deal disagree.

"We cannot let a murderous regime continue these destabilizing activities while building dangerous missiles, and we cannot abide by an agreement if it provides cover for the eventual construction of a nuclear program," Trump said Tuesday.

His voice rising, Trump strongly hinted that his administration could soon declare Tehran out of compliance, which could unravel the accord.

"I don't think you've heard the last of it — believe me," he said.

Israeli Prime Minister Benjamin Netanyahu, a vehement opponent of the deal, looked pleased as he and his wife, Sara, listened to Trump's address.

"In more than 30 years of my acquaintance with the U.N., I have not heard a more courageous and sharp speech," Netanyahu said of Trump in his own speech Tuesday.

Iranian leaders sharply rebuked the U.S. president.

In a meeting with American media executives ahead of the speech, Iranian President Hassan Rouhani said Iran has complied fully and predicted that the United States will be the loser if it "tramples upon" the agreement.

"Everyone will clearly see that Iran has lived up to its agreements and that the United States is therefore a country that cannot be trusted," Rouhani said.

Aides have rejected the notion that Trump's rhetoric and name-calling fall outside the bounds of international norms, suggesting that the president is merely employing language his rivals understand.

"The scourge of our planet today is a small group of rogue regimes that violate every principle on which the United Nations is based," Trump said. ". . . If the righteous many do not confront the wicked few, then evil will triumph."