Sheikh Abdul Aziz al-Sheikh, the Saudi grand mufti listens to a speech of King Abdullah of Saudi Arabia at the Consultative Council in Riyadh, Saudi Arabia, Tuesday, March 24, 2009. King Abdullah formally opened the fifth session of the Consultative Council on Tuesday, the closest thing the kingdom has to a parliament. (AP Photo/Hassan Ammar)

RIYADH, Aug 19 (Reuters) - Saudi Arabia's Grand Mufti Sheik Abdulaziz Al al-Sheik, the highest religious authority in the country, said on Tuesday the militant groups Islamic State and al Qaeda were "enemy number one of Islam" and not in any way part of the faith.

Although the mufti and other senior Saudi clerics have condemned Islamic State, al Qaeda and other groups before, the timing of Al al-Sheik's statement is significant given the gains by militants in Iraq.

"Extremist and militant ideas and terrorism which spread decay on Earth, destroying human civilisation, are not in any way part of Islam, but are enemy number one of Islam, and Muslims are their first victims," he said in a statement carried by the official Saudi Press Agency.

He later compared them to the Kharijite movement in early Islam, which assassinated the Prophet Mohammed's son-in-law Ali for making compromises to a rival Muslim faction, and has been seen as heretical by most subsequent Muslim sects.

Saudi Arabia follows the ultra conservative Wahhabi school of Sunni Islam but sees Islamist militants, who staged attacks in the kingdom last decade, as posing a threat to its own stability.

Although senior Wahhabi clerics endorse execution by beheading for offenses that include apostasy, adultery and sorcery, oppose women driving or working and describe Shi'ites as heretics, they differ from al Qaeda and Islamic State militants in opposing violent revolt.

Riyadh has been a main supporter of rebels battling Syrian President Bashar al-Assad, but has funneled arms and money away from Islamic State and al Qaeda towards other opposition groups.

Wahhabi clerics, who hold senior government positions and lend the ruling al-Saud Islamic legitimacy, oversee a massive religious infrastructure paid for by the state and are sometimes dismissed by militants as being in the government's pocket.

Thousands of young Saudis are believed to have traveled to Syria and Iraq to join rebel and militant groups, spurring concern within the authorities that they may eventually launch attacks on their own government.

Saudi Arabia labeled Islamic State, al Qaeda, Nusra Front and other groups as "terrorist" in March and imposed long prison terms for offering them public support or giving them moral or material aid.

Early this month King Abdullah made a speech attacking militant groups that used Islamic justifications, and urged Muslim scholars and leaders to fight against them.

(Reporting by Angus McDowall; Editing by Alison Williams)