US President Donald Trump has urged Arab and Islamic leaders to unite and do their share to defeat Islamist extremists, making an impassioned plea to "drive out" terrorists while toning down his own harsh rhetoric about Muslims.
Trump singled out Iran as a key source of funding and support for militant groups, aligning with the views of his Saudi Arabian hosts and sending a tough message to Tehran a day after Hassan Rouhani won a second term as Iran's president.
The US president avoided using his signature term "radical Islamic terrorism" in the speech, a sign that he has heeded advice to moderate his tone after using the phrase repeatedly as a presidential candidate.
"Terrorism has spread all across the world. But the path to peace begins right here, on this ancient soil, in this sacred land," Trump told leaders from about 50 Muslim-majority countries on Sunday.
"A better future is only possible if your nations drive out the terrorists and drive out the extremists. Drive them out! Drive them out of your places of worship, drive them out of your communities, drive them out of your holy land and drive them out of this earth."
The president's first speech abroad provided an opportunity to show his strength and resolve, in contrast to his struggle to contain a mushrooming scandal at home after his firing of former FBI Director James Comey nearly two weeks ago.
He portrayed the conflict as between good and evil, not civilisations, and said Washington would partner with the Middle East but expected more action in return.
"There is still much work to be done. That means honestly confronting the crisis of Islamic extremism, and the Islamists, and Islamic terror of all kinds," he said in his speech.
The advance excerpts of the speech had him saying "Islamist extremism." A White House official blamed Trump's fatigue for the switch.
The term "Islamist extremism" refers to Islamism as a political movement rather than Islam as a religion, a distinction that the Republican president had frequently criticised the administration of his Democratic predecessor, Barack Obama, for making.
During the election campaign Trump proposed temporarily banning Muslims from entering the US but in office his temporary bans on several Muslim-majority countries have been blocked by courts and ruled as discriminatory.
The speech in a gilded hall bedecked with chandeliers is part of an effort to redefine his relationship with the Muslim world after his "America first" philosophy helped him win the 2016 election, while rattling allies who depend on the US for defence.
Trump received a warm welcome from Arab leaders, as he set aside his campaign rhetoric and focused on his desire to crack down on Iran's influence in the region.
"For decades, Iran has fuelled the fires of sectarian conflict and terror," Trump said. "It is a government that speaks openly of mass murder, vowing the destruction of Israel, death to America, and ruin for many leaders and nations in this very room."
Trump did not make overt mentions of human rights abuses in Saudi Arabia or the other Gulf nations in his speech.
Iranian Foreign Minister Mohammad Javad Zarif fired back at Trump tweeting that Trump had attacked Iran in "that bastion of democracy & moderation" of Saudi Arabia, suggesting he had "milked" his hosts for hundreds of billions of dollars in business deals.
Introducing Trump, Saudi King Salman described their mutual foe Iran as the source of terrorism they must confront together.
"Our responsibility before God and our people and the whole world is to stand united to fight the forces of evil and extremism wherever they are ... The Iranian regime represents the tip of the spear of global terrorism," the king said.
Trump's Riyadh visit kicked off his first presidential trip abroad, with Saudi Arabia the first stop on a nine-day journey through the Middle East and Europe.