President Trump, in a fiery address Tuesday before the U.N. General Assembly, tore into open-border activists for pushing what he described as an "evil" agenda under the "cloak" of social justice, while warning Iran to abandon its confrontational course and delivering arguably his most robust defense yet of his nationalist philosophy.

"Today, I have a message for those open border activists who cloak themselves in the rhetoric of social justice: Your policies are not just, your policies are cruel and evil," he said, accusing them of promoting human smuggling and the "erasure of national borders."

AMERICA 'ISOLATED' AT UN? GENERAL ASSEMBLY BREAKS WITH US ON MOST VOTES, REPORT FINDS

“You are empowering criminal organizations that prey on innocent men, women and children. You put your own false sense of virtue before the lives and well-being of countless innocent people,” he said. "When you undermine border security, you are undermining human rights and human dignity."

He delivered the broadside as part of a message promoting border security, in the U.S. and around the world. This dovetailed with a broader theme of railing against open borders and "globalists," in the halls of the world body increasingly known for espousing that approach.

The president's tone was steady and somber. But the message was that of a muscular nationalism that he has spent the better part of three years defining. As part of his speech, he later ripped into social media giants, media groups and academics -- whom he accused of being part of a "permanent political class" that sought to undermine the will of the people.

"Wise leaders always put the good of their own people and their country first. The future does not belong to globalists, the future belongs to patriots," he said earlier in the speech. "The future belongs to sovereign and independent nations who protect their citizens, respect their neighbors and honor the differences that make each country special and unique."

He advised member states, "If you want freedom, take pride in your country. If you want democracy, hold on to your sovereignty. If you want peace, love your nation."

Trump, who has centered his presidency around an “America First” agenda, used his 2017 and 2018 addresses to defend and promote the importance of national sovereignty -- a message that clashes with the more globalist outlook of the world body. He said that he wants to avoid "endless wars" but also promised to defend America militarily, if needed.

He used that message to pivot to Iran, urging the Islamic regime to put its people first and to abandon its quest for nuclear weapons and support of terror in the region. He told delegates that the U.S. does not seek conflict with other nations but that “I will never fail to defend America’s interests.”

NEW UN AMBASSADOR KELLY CRAFT VOWS 'STRONG AMERICAN LEADERSHIP' AS SHE TAKES HER POST

He accused Iran's leaders of "fueling the tragic wars in both Syria and Yemen," and of "squandering their nation's wealth in a fanatical quest for nuclear weapons and the means to deliver them."

"We must never allow this to happen," he said.

He was given a boost on his hardline stance with Iran on Monday when Britain, France and Germany joined the U.S. in blaming Iran for attacks earlier this month on key oil facilities in Saudi Arabia. They said in a statement that “there is no other plausible explanation” than that “Iran bears responsibility for this attack.”

"All nations have a duty to act, no responsible government should subsidize Iran's bloodlust," he said, promising to tighten sanctions if Iran continued its aggression.

The move marks a significant win for the U.S., which has been trying to rally European nations to its side in its “maximum pressure” campaign against Tehran. Last year it pulled out of the 2015 Iran nuclear deal, despite criticism from allies that had signed onto the pact.

The U.S. has since imposed waves of sanctions, including on Iran’s central bank last week. Trump said last week in the Oval Office that Iran could stop the sanctions if it would stop supporting terrorism. He has also opened the door to meeting with Iranian President Hassan Rouhani.

On Tuesday, he also used the speech to address the ongoing trade war with China, saying that at the heart of his vision is “an ambitious campaign to reform international trade."

“For decades, the international trading system has been easily exploited by nations acting in very bad faith,” he said. “As jobs were outsourced, a small handful grew wealthy at the expense of the middle class.”

CLICK HERE FOR THE FOX NEWS APP

In his criticism of other leaders, he also appeared to take a swipe at former U.S. leaders who let China gain international dominance.

"Globalism exerted a religious pull over past leaders, causing them to ignore their own national interests, but as far as America is concerned, those days are over," he said.

Fox News' John Roberts and Frank Miles contributed to this report.