U.S. Defense Secretary James Mattis arrives as his meeting with Ajit Doval, National Security Advisor of India, at the Pentagon in Washington, U.S., March 24, 2017. REUTERS/Yuri Gripas

DUBAI (Reuters) - Iran rejected an allegation by U.S. Defense Secretary James Mattis that it was “the primary exporter of terrorism” and said on Saturday that the main source was U.S. ally Saudi Arabia.

“Some countries led by America are determined to ignore the main source of Takfiri-Wahhabi terrorism and extremism,” foreign ministry spokesman Bahram Ghasemi was quoted by Iran’s state news agency IRNA as saying.

He was referring to hardline Sunni Muslim groups and Saudi Arabia’s official Wahhabi school of Islam.

Saudi Arabia denies backing terrorism and has cracked down on jihadists at home, jailing thousands, stopping hundreds from traveling to fight abroad and cutting militant finances.

Shi’ite Muslim power Iran and Saudi Arabia, bastion of Sunni Islam and a close U.S. ally, are longstanding religious and political arch rivals and often accused each other of backing terrorism. Relations are fraught as they back each other’s foes in regional wars such as in Yemen, Iraq and Syria.

“Giving a wrong address when referring to the roots and the financial and intellectual resources of terrorism is a main reason for a lack of success by international anti-terror efforts,” Ghasemi added.

Ghasemi was reacting to remarks by Mattis on Friday when he was asked about comments he made in 2012 that the three main threats the United States faced were “Iran, Iran, Iran”.

“At the time when I spoke about Iran I was a commander of U.S. Central Command and that (Iran) was the primary exporter of terrorism, frankly, it was the primary state sponsor of terrorism and it continues that kind of behavior today,” Mattis told reporters.