Javad Zarif, Minister of Foreign Affairs of the Islamic Republic of Iran attends the annual meeting of the World Economic Forum (WEF) in Davos, Switzerland, January 18, 2017. REUTERS/Ruben Sprich

BEIRUT (Reuters) - Iranian Foreign Minister Mohammad Javad Zarif on Sunday criticized U.S. President Donald Trump for sealing an arms deal and other investments worth hundreds of billions of dollars with Saudi Arabia, Tehran’s arch-rival in the Middle East.

Zarif’s comments came hours after Trump, who is visiting Saudi Arabia, urged Arab and Islamic leaders to unite and defeat Islamist extremists. Trump singled out Iran as a key sponsor of militant groups, sending a tough message to Tehran the day after Hassan Rouhani won a second term as Iran’s president.

“Iran - fresh from real elections - attacked by @POTUS in that bastion of democracy & moderation. Foreign Policy or simply milking KSA of $480B?,” Zarif wrote in a Twitter post, referring to the Kingdom of Saudi Arabia.

Iran and Saudi Arabia have long accused each other of sponsoring militias aligned to their competing sects of Islam in conflicts across the Middle East.

Introducing Trump, Saudi King Salman described Tehran as a mutual foe and a source of terrorism they must confront together.

In his first keynote speech abroad, Trump sought to redefine his relationship with the Muslim world, and focused on his desire to curb Iran’s influence in the region.

“For decades, Iran has fueled the fires of sectarian conflict and terror,” he said.