DUBAI (Reuters) - Iran’s foreign minister, Mohammad Javad Zarif, advised U.S. President Donald Trump to discuss how to avoid another September 11 attack with the Saudi hosts of his first official visit abroad, Zarif wrote in an editorial published on Sunday.

Iranian Foreign Minister Mohammad Javad Zarif speaks to the media in Tbilisi, Georgia, April 18, 2017. REUTERS/David Mdzinarishvili

Tehran and Riyadh are regional arch-rivals which accuse each other of sponsoring fundamentalist militias aligned to their competing sects of Islam in war zones across the Middle East.

Critics of Saudi Arabia say its strict view of Islam fuels Sunni extremism, called takfir, and some even accuse the kingdom of responsibility for the September 11 attacks.

Saudi Arabia denies providing any support for the 19 hijackers - most of whom were Saudi citizens - who killed nearly 3,000 people in 2001.

“(Trump) must enter into dialogue with them about ways to prevent terrorists and takfiris from continuing to fuel the fire in the region and repeating the likes of the September 11 incident by their sponsors in Western countries,” Zarif wrote for the website of the London-based Al Araby Al-Jadeed news network.

At a campaign event last February, Trump himself suggested to supporters that the kingdom may be behind the attacks.

“You will find out who really knocked down the World Trade Center because they have papers out there that are very secret. You may find it’s the Saudis, okay, but you will find out.”

But since his election, Trump has put an end to his sharp commentary in public and on his twitter account about the key U.S. ally and the world’s top oil exporter.

Separately, a senior Iranian military official rejected a call by U.S. Secretary of State Rex Tillerson for newly re- elected Iranian President Hassan Rouhani to end Tehran’s ballistic missile program and what he called its “network of terrorism”.

Brigadier General Masoud Jazayeri, deputy chief of staff of Iran’s armed forces, said Tillerson’s remarks “reflected ignorance about Iran”, the state news agency IRNA reported.

“Iran’s defense policies and aims follow a set trend that cannot be affected by any element,” Jazayeri said.

Iran’s hardline-led security and military bodies operate separately to the presidency and are close to the country’s ultimate authority - Supreme Leader Ayatollah Ali Khamenei.

Speaking at a news conference in Riyadh on Saturday, Tillerson also said: “I’m not going to comment on my expectation. But we hope that if Rouhani wanted to change Iran’s relationship with the rest of the world those are the things that he could do.”

On the second day of his visit to Riyadh, the president is set to deliver an appeal to leaders from across the Arab and Muslim world to unite against the common threat posed by Islamist militants.