RIYADH, Saudi Arabia — President Donald Trump offered a message of unity Sunday as he called on the Arab world to confront extremism during a highly anticipated speech in the birthplace of Islam.
"A better future is only possible if your nations drive out the terrorists and extremists," Trump told the dozens of Muslim leaders who attended his remarks.
"Drive. Them. Out. Drive them out of your places of worship," the president continued. "Drive them out of your communities. Drive them out of your holy land, and drive them out of his Earth!"
The speech during the initial stop of the president's first foreign trip was a stark contrast to his previous comments on Islam. As a candidate, Trump frequently criticized the religion, saying, "I think Islam hates us" and "there's a tremendous hatred there."
In Riyadh, Trump said, "This is not a battle between different faiths, different sects, or different civilizations. This is a battle between barbaric criminals who seek to obliterate human life, and decent people of all religions who seek to protect it."
Calling terrorists "the foot soldiers of evil," the president added, "If we do not stand in uniform condemnation of this killing, then we not only will be judged by our people, not only will we be judged by history, but we will be judged by God."
The U.S.'s Middle Eastern allies have often complained about America's focus on human rights, a stance Trump also seemed keen to make a break from.
"America is a sovereign nation and our first priority is always the safety and security of our citizens," the president said. "We are not here to lecture — we are not here to tell other people how to live, what to do, who to be, or how to worship. Instead, we are here to offer partnership — based on shared interests and values — to pursue a better future for us all."
Introducing Trump, Saudi Arabia’s King Salman spoke of the need "to stand united to fight the forces of evil and extremism."
"There is no honor in committing murder," Salman said, adding that Islam is "the religion of peace and tolerance."
PHOTOS: Trump in Saudi Arabia
In his address, Trump defined the struggle against extremism as "a battle between good and evil."
"Barbarism will deliver you no glory — piety to evil will bring you no dignity," the president said. "If you choose the path of terror, your life will be empty, your life will be brief, and your soul will be condemned."
Trump also offered a firm rebuke of Iran — a notable departure from the Obama administration's overtures to the country which had caused a chill in relations with the Saudi government.
Calling out Iranian leaders for training terrorists and "spreading destruction and chaos across the region," Trump, who has called for ripping up the nuclear deal with Iran, implored all nations to "work together to isolate" Tehran until the regime is "willing to be a partner for peace."
RELATED: Read the full speech here
"Pray for the day when the Iranian people have the just and righteous government they so richly deserve," he said.
Trump also included a brief reference to his hope for peace between Israel and the Palestinians — a deal he has repeatedly said he hopes to broker during his time in office. Trump noted "peace in this world is possible — including peace between Israelis and Palestinians. I will be meeting with both Israeli Prime Minister Benjamin Netanyahu and Palestinian President Mahmoud Abbas."
In the speech at the King Abdul Aziz Conference Center, Trump did not use the phrase "radical Islamic terror" — one he uttered repeatedly on the campaign trail, and lambasted his predecessor for not saying. The president did refer to "confronting the crisis of Islamic extremism and the Islamists and Islamic terror of all kinds."
Asked about Trump's use of the multiple terms, a White House official attributed it to exhaustion, not pre-calculation. The president's "just an exhausted guy," the official said, who went through many drafts of the speech.
Trump called on countries in the region to do the hard work themselves and not to expect the U.S. to fight terror for them.
"The nations of the Middle East cannot wait for American power to crush this enemy for them. The nations of the Middle East will have to decide what kind of future they want for themselves, for their countries, and for their children," Trump said. "Muslim-majority countries must take the lead in combating radicalization."
Trump said he hoped the gathering of the region's leaders in Riyadh would mark the beginning of the end of terrorism and the start of peace in the Middle East.
"This region should not be a place that refugees flee, but to which newcomers flock,'' the president said.
His presidential campaign was rife with anti-Muslim comments and promises, including his support for surveillance of mosques in the U.S. and for a "total and complete shutdown of Muslims entering the United States until our country's representatives can figure out what is going on."
As president, Trump made good on a version of that promise by signing a travel ban that has been stalled in the courts but which would have temporarily barred entry to those from a handful of Muslim-majority countries, although not Saudi Arabia.
On Saturday, Trump received a royal greeting after touching down in the country. The pomp and pageantry included a signing ceremony for a military arms deal to Saudi Arabia, worth $110 billion effective immediately and up to $350 billion over 10 years, and ended with a boisterous banquet filled with music and dancing.
"That was a tremendous day. Tremendous investments in the United States," Trump told reporters Saturday. "Hundreds of billions of dollars of investments into the United States and jobs, jobs, jobs."
Earlier Sunday before his speech, Trump held meetings with other regional leaders during which he touted "lots of beautiful military equipment" that U.S. workers manufacture.
Watch Trump's speech here: