DUBAI (Reuters) - When Saudi Arabia's Grand Mufti Sheikh Abdulaziz Al al-Sheikh described Islamic State and al Qaeda as "kharijites" last month, he was casting them as the ultimate heretics of Muslim history, a sect that caused the faith's first and most traumatic schism.
That sort of rhetoric aimed at expelling militants from the Muslim mainstream has grown increasingly common among top Saudi clerics in recent weeks as they work to counter an ideology that threatens their political allies in the Al Saud dynasty.
But while Saudi Arabia's official Wahhabi school of Sunni Islam attacks Islamists as heretical and "deviant", many of its most senior and popular clergy preach a doctrine that encourages intolerance against the very groups targeted by IS in Iraq.
The arch conservatives Abdulrahman al-Barrak and Nasser al-Omar, who has more than a million followers on Twitter, have accused Shi'ites of sowing "strife, corruption and destruction among Muslims".
Sheikh Saleh al-Luhaidan was sacked as judiciary head in 2008 for saying owners of media that broadcast depravity have forsaken their faith, a crime punishable in Sharia law by death, but he remains a member of the kingdom's top Muslim council.
Abdulaziz al-Fawzan, a professor of Islamic law and frequent guest on the popular al-Majd religious television channel, has accused the West of being behind the Sept. 11, 2001 attacks on the United States, saying "these criminals want to take control over the world".
Such opinions, which echo the views of militants in Iraq, are not unusual in Saudi Arabia, which applies Sharia Muslim law, has beheaded 20 people in the past month, and where clerics oversee a lavish state-funded religious infrastructure.
Saudi Arabia and its ultra conservative Wahhabi school are often seen in the West as the ideological wellspring of al Qaeda, which has staged attacks across the world and of Islamic State, which has beheaded hostages in Syria and Iraq.
It is a viewpoint vociferously denied by the Saudi establishment, including the ambassador to London, Prince Mohammed bin Nawaf, who wrote last month that it "does not even faintly correspond" with Wahhabi teachings.
The Al Saud are sensitive to such criticism not only because of the costs of suppressing a militant insurgency a decade ago that killed hundreds, but because their legitimacy rests partly on religious credentials underwritten by Wahhabi clerics.
Saudi authorities point to the influence of the radical wing of the Muslim Brotherhood in developing modern jihadi thinking, but play down Riyadh's decades of support for Islamists around the world as a counterweight to anti-royal leftist ideology.
The government's inability or reluctance to crack down on expressions of intolerance towards non-Sunnis has led some Saudi liberals and foreign analysts to ask if the kingdom is committed to tackling radicalism's roots, or only its symptoms.
"It's their definition of extremism we may not agree with. It is still very mainstream to call Shi'ites infidels. That's not seen as extremist," said Stephane Lacroix, author of Awakening Islam, a book about Islamism in Saudi Arabia.
When the Al Saud first raised a state near Riyadh in the mid 18th century, they did so with the support of a local preacher, Mohammed ibn Abd al-Wahhab, whose purist doctrine is often known as Wahhabism, a term rejected by those who follow it.
Wahhabi ideology is focused on eliminating incorrect doctrine, particularly when it appears to undermines monotheism, a category that includes Shi'ite reverence for the Prophet Mohammed's descendents and the Christian belief in a trinity.
Like Shi'ites, the Kharijites wanted Mohammed to be replaced as leader of the Muslims by his son-in-law, Ali, but they later assassinated him for compromising with the early Sunnis. That act won them the enmity of both Islam's main sects.
Wahhabi clergy offer legitimacy and public support to a king who styles himself "custodian of the two holy mosques", and leave all matters of governance and foreign policy to him so long as his edicts do not contradict Muslim law.
In return, the ruling family has given them top government jobs, control over Saudi Arabia's Sharia Muslim law, great influence over social issues and public morality, and funds for foreign evangelism and massive Wahhabi seminaries.
Riyadh, which sees itself as a protector of Sunnis against Shi'ite factions manipulated by an expansionist Iran, has given arms and cash to Syrian rebels fighting President Bashar al-Assad, a member of the Alawite sect close to Shi'ites.
But it also sees militant groups among the rebels, including IS and the Nusra Front, as a threat to its own security, fearing that thousands of Saudi nationals who have gone to fight there will be radicalised and target their own country.
It has declared both groups illegal and imposed long prison terms for any who offer them support, help them raise money or join them to fight.
That position is backed by the Wahhabi establishment, which has declared the struggle in Syria a jihad, or holy war, for the Syrian people, but not for Saudis, and repeatedly urged citizens not to go to fight.
"Peace and war have to be directed by the government and the king himself. As for those encouraging others to go and fight, I don't agree with it at all. It doesn't comply with our religion and it's not legal," said Sheikh Abdulmohsen Al al-Sheikh, a former member of the Sharia faculty at Mecca's Umm al-Qura seminary.
The militants, in turn, often cite Wahhabi clerics from the 18th and 19th century, but they regard their modern successors as tools of the Saudi government, which they have vowed to topple with the slogan "kadimoun" or "we are coming".
"The jihadis stopped citing senior mainstream Saudi clerics many years ago," said Thomas Hegghammer, a research fellow at the Norwegian Defense Research Establishment and author of Jihad in Saudi Arabia.
Even the few Saudi clerics who once supported al Qaeda, and are now in prison in the kingdom, are shunned by IS because of its own rift with the older militant group, he said.
However, there are clearly contacts between some lower-level clerics and militants in Iraq and Syria. The authorities said last month they had detained mosque imams who urged people to go and join the fight and prepared sermons for use by IS fighters.
Another cleric was sentenced to five years in prison in August for "glorifying" extremist ideology and urging others to go to Syria to fight. Thousands of Saudis are believed to have joined militant groups in Syria and Iraq.
Over the past decade, the authorities have tried to hem in radical clergy by imprisoning or sacking those who overtly support militancy. They have vetted Friday sermons and restricted the power to issue fatwas (religious rulings) to the 21 members of the Council of Senior Scholars.
This does not go far enough for liberal Saudis. They believe the clergy's willingness to use highly sectarian language and voice contempt or hatred for non-Muslims fuels radical ideology.
"The only way to fight al Qaeda and Islamic State is by being transparent and open about it. We have a problem: some of our teachings promote militancy and we don't need those teachings any more," said Jamal Khashoggi, head of a television news channel owned by a prince.
Some school textbooks, many of which are written by clerics, still feature strong sentiments against non-Muslims despite Riyadh's pledge to purge the curriculum of intolerant language.
King Abdullah has pushed more tolerant interpretations of Wahhabi thought, appointing Shi'ites to the Shoura Council which advises on policy and calling for a new center to study Islam's sects to be built in Riyadh, to the chagrin of some Wahhabis.
However, he has also been quoted in a 2006 U.S. embassy cable released by WikiLeaks as attacking Shi'ites for "worshipping stones, domes and statues" and has done little to rein in clerical attacks on the sect.
"Anti-Shi'ism in Saudi religious discourse is extremely strong. So Saudis are open to understanding and accepting those justifications for militancy," said Lacroix.
Supporters of the Al Saud argue they have to tread carefully when dealing with conservative clerics. They say the ruling family is more liberal than most Saudi citizens, and is wary of provoking public anger.
But liberal Saudis and some foreign analysts say that is not the case, and argue that if the government really wanted to reduce intolerant religious discourse, it could readily do so.
"When the government wants things to be done, they will be done," said Mohammed al-Zulfa, a former member of the Shoura Council and an early public advocate of allowing women to drive.
Editing by William Maclean and Paul Taylor