* Signs of detente emerge in recent months
* ISIL is enemy of Tehran but no friend of Riyadh
* Iran blames Saudis for stoking Sunni militancy
* Saudis fear Iran will arm Shi'ite militias to fight ISIL
By William Maclean
DUBAI, June 13 (Reuters) - This week's advance by Sunni insurgents in Iraq provides a powerful argument for why Iran and Saudi Arabia should bury their Cold War-style feud, but is nonetheless likely to set back detente between the Gulf's dominant Sunni and Shi'ite powers.
After decades of often overt Saudi-Iranian hostility that polarised the Middle East - and three years of proxy war in Syria - the Sunni monarchy and Shi'ite revolutionary state had gingerly begun in recent months to explore ways to reach out.
Saudi Arabia announced in May it had invited Iran's Foreign Minister Mohammed Javad Zarif to make a rare visit. Early this month, the emir of Kuwait - a Sunni monarch and close Saudi ally - made the first visit to Iran by a Kuwaiti head of state since the 1979 Iranian revolution. He met Supreme Leader Ali Khamenei.
With Syria's civil war stalemated, unrest spreading across the region and Iran seeking a nuclear deal with the West, Tehran and Riyadh have reasons to seek a way to cooperate, as they have occasionally in the past. Diplomats say that at very least they could be looking for a way to avoid making the situation in the region worse.
This week's lightning advance across Iraq by the Islamic State of Iraq and the Levant (ISIL) reinforces the argument for a rapprochement: Tehran and Riyadh both share the fear that Iraq could disintegrate into a sectarian bloodbath dangerous to all.
But in the short term, ISIL's advance is likely to raise suspicions, which will only make any thaw more difficult.
"The Saudi-Iran rapprochement must now be on hold," Jamal Khashoggi, head of a television news station owned by Saudi billionaire Prince Alwaleed bin Talal, told Reuters.
ISIL, an offshoot of al Qaeda that denounces the global Sunni jihadist group for not being extreme enough, is most obviously an enemy of Iran: it considers all Shi'ites to be heretics deserving death and slaughters hundreds of Shi'ite civilians a month in daily bombings in Iraq.
But it is also no friend of Riyadh's, having battled Saudi Arabia's allies in infighting among Sunni rebels in Syria.
Riyadh last month designated ISIL a terrorist organisation, underscoring concern that young Saudis hardened by battle could come home to target the ruling Al Saud royal family - as happened after the wars in Afghanistan and Iraq.
ISIL's ruthlessness means that Riyadh will not welcome its advances, even if they come at the expense of Iraqi Prime Minister Nuri al-Maliki, a Shi'ite that Saudi Arabia regards as Iran's pawn.
"In normal circumstances, Saudi Arabia might welcome the humbling of Maliki, but an anarchic Iraq partly controlled by violent Islamic radicals would be hugely unwelcome," said Shaul Bakhash, a professor of history at George Mason University in Virginia.
But publicly, Saudi Arabia has yet to condemn ISIL's advance. Tehran is likely to see that ambiguity as confirmation that the kingdom is a Sunni supremacist power, unwilling to cooperate against a Sunni foe, even if it poses a mutual threat.
"There will be additional tensions between Iran and Saudi Arabia" unless the Saudis openly condemn ISIL's push, said Mohsen Milani, an Iran expert at the University of South Florida.
Whether or not Tehran directly blames Riyadh for ISIL's actions, it is bound to see it as an outgrowth of Saudi Arabia's promotion of Sunni armed groups in Syria, fighting against Iran's ally Bashar al-Assad.
Iran has long warned the Gulf states that they risk a blowback by supporting "takfiri" militants, Sunnis who proclaim followers of other sects of Islam to be "kafirs" - infidels - and therefore legitimate targets of holy war.
"Unfortunately, a number of regional countries are not aware of the danger that takfiri groups will cause for them in the future and they are still supporting these groups," Supreme Leader Khamenei said after his meeting with Kuwait's emir.
This week, the Islamic Revolution's Guard Corps Deputy Commander, Brigadier-General Hossein Salami, blamed ISIL's activities on "the meddling of bullying powers and their allies in the region" - code for Gulf states allied to the West.
For its part, Riyadh's worry is that Iran will respond to ISIL's advance by sending weapons, advisors and cash to strengthen both the Shi'ite-led government in Baghdad and Shi'ite sectarian militia mobilising to fight against ISIL.
Riyadh sees an Iranian hand not only in supporting Syria's Assad but also in fuelling Shi'ite unrest in Bahrain, Yemen and even potentially among Saudi Arabia's own Shi'ite minority. Watching Tehran promote a sectarian response in Iraq to ISIL is bound to raise Saudi hackles.
A source familiar with Saudi policy described the past few days developments in Iraq as a testing time for Iran-Saudi ties. (Additional reporting by Parisa Hafezi in Ankara, Angus McDowall in Riyadh, Adrian Croft in Brussels, Mariam Karouny and Domimic Evans in Beirut, Mehrdad Balali and Sami Aboudi in Dubai Editing by Peter Graff)