It seemed like a good idea at the time. Thanks to the immediacy of television, innocent civilians in Syria were writhing from gas attacks before our eyes, with the blame laid on their own government. Yet despite a red line having been crossed by this use of chemical weapons, the international community decided against air strikes on the Assad regime.

Instead we encouraged two oil-rich Arab states, Qatar and Saudi Arabia, to continue arming rebel groups to oust the ruthless dictator in Damascus. Now, thanks to those weapons, one of the groups has grown into the Frankenstein's monster of the so-called Islamic State whose brutal fighters have swept through Syria and Iraq, crucifying and beheading like a deadly inhuman tide.

Saudi Arabia has been a major source of financing to rebel and terrorist organisations since the 1970s, thanks to the amount it has spent on spreading its puritan version of Islam, developed by Mohammed Abdul Wahhab in the 18th century. The US State Department has estimated that over the past four decades Riyadh has invested more than $10bn (£6bn) into charitable foundations in an attempt to replace mainstream Sunni Islam with the harsh intolerance of its Wahhabism. EU intelligence experts estimate that 15 to 20 per cent of this has been diverted to al-Qa'ida and other violent jihadists.

The only other official Wahhabi country is Saudi's Gulf neighbour Qatar, which is, per capita, the richest country in the world. It likes to paint itself as a more liberal and open version of the Muslim sect. Its newest and biggest mosque is named after Wahhab, but this is the fun, football-loving version.

The Qataris are Barcelona's shirt sponsors, the owners of Paris St-Germain and, albeit amid allegations of dodgy financial footwork, will host the 2022 World Cup – to which, to the horror of their Saudi neighbours, women will be admitted.

In Qatar, unlike Saudi, women are allowed to drive and travel alone. Westerners can eat pork and drink alcohol. There is no religious police force or powerful class of clerics to enforce morality. Qatar's Al Jazeera television network stands in contrast with the region's state-controlled media, and the Qataris are investing in the West, including the Shard, Harrods and big chunks of Sainsbury's and the London Stock Exchange.

In pictures: The rise of Isis Show all 74 1 /74 In pictures: The rise of Isis In pictures: The rise of Isis Isis fighters Fighters of the Islamic State wave the group's flag from a damaged display of a government fighter jet following the battle for the Tabqa air base, in Raqqa, Syria AP In pictures: The rise of Isis Isis fighters Fighters from Islamic State group sit on their tank during a parade in Raqqa, Syria AP In pictures: The rise of Isis Isis fighters Fighters from the Islamic State group pray at the Tabqa air base after capturing it from the Syrian government in Raqqa, Syria AP In pictures: The rise of Isis Isis fighters Fighters from extremist Islamic State group parade in Raqqa, Syria AP In pictures: The rise of Isis Isis kidnapping A video uploaded to social networks shows men in underwear being marched barefoot along a desert road before being allegedly executed by Isis Getty Images In pictures: The rise of Isis Isis kidnapping Haruna Yukawa after his capture by Isis In pictures: The rise of Isis Isis kidnapping Khalinda Sharaf Ajour, a Yazidi, says two of her daughters were captured by Isis militants Washington Post In pictures: The rise of Isis Isis fighters Spokesperson for Isis Vice News via Youtube In pictures: The rise of Isis A pro-Isis leaflet A pro-Isis leaflet handed out on Oxford Street In London Ghaffar Hussain In pictures: The rise of Isis Isis fighters Isis Jihadists burn their passports In pictures: The rise of Isis Isis controls Syrian Aid A man collecting aid administered by Isis in Syria In pictures: The rise of Isis Isis controls Syrian Aid A woman collecting aid administered by Isis in Syria In pictures: The rise of Isis Isis controls Syrian Aid Local civilians queue for aid administered by Isis. Since it declared a caliphate the group has increasingly been delivering services such as healthcare, and distributing aid and free fuel In pictures: The rise of Isis Iraq crisis Iraqi security forces detain men suspected of being militants of the Isis group in Diyala province In pictures: The rise of Isis Iraq crisis Mourners carry the coffin of a Shi'ite volunteer from the brigades of peace, who joined the Iraqi army and was killed during clashes with militants of the Isis group in Samarra, during his funeral in Najaf In pictures: The rise of Isis Iraqi refugees An Iraqi Shiite Turkmen family fleeing the violence in the Iraqi city of Tal Afar, west of Mosul, arrives at a refugee camp on the outskirts of Arbil, in Iraq's Kurdistan region In pictures: The rise of Isis Isis leader Abu Bakr al-Baghdadi A photograph made from a video by the jihadist affiliated group Furqan Media via their twitter account allegedly showing Isis leader Abu Bakr al-Baghdadi delivering a sermon during Friday prayers at a mosque in Mosul. Abu Bakr al-Baghdadi declared an Islamist caliphate in the territory under the group's control in Iraq and Syria In pictures: The rise of Isis Islamic extremists destroying mosques in Iraq Shiite's Al-Qubba Husseiniya mosque explodes in Mosul In pictures: The rise of Isis Islamic extremists destroying mosques in Iraq Smoke and debris go up in the air as Shiite's Al-Qubba Husseiniya mosque explodes in Mosul. Images posted online show that Islamic extremists have destroyed at least 10 ancient shrines and Shiite mosques in territory - the city of Mosul and the town of Tal Afar - they have seized in northern Iraq in recent weeks In pictures: The rise of Isis Islamic extremists destroying mosques in Iraq A bulldozer destroys Sunni's Ahmed al-Rifai shrine and tomb in Mahlabiya district outside of Tal Afar In pictures: The rise of Isis Iraq crisis Iraqi security forces celebrate after clashes with followers of Shiite cleric Mahmoud al-Sarkhi, in front of his home in the Shiite holy city of Karbala, 50 miles (80 kilometers) south of Baghdad In pictures: The rise of Isis Iraq crisis Iraqi security forces arrest a follower of Shiite cleric Mahmoud al-Sarkhi after clashes with his followers in the Shiite holy city of Karbala, 50 miles (80 kilometers) south of Baghdad In pictures: The rise of Isis Iraq crisis Iraqi security forces arrest a follower of Shiite cleric Mahmoud al-Sarkhi at his home after clashes with his followers in the Shiite holy city of Karbala, 50 miles (80 kilometers) south of Baghdad In pictures: The rise of Isis Iraq crisis Iraqi security forces arrest a follower of Shiite cleric Mahmoud al-Sarkhi after clashes with his followers in the Shiite holy city of Karbala, 50 miles (80 kilometers) south of Baghdad In pictures: The rise of Isis Iraq crisis A vehicle burns in front of a home of a follower of Shiite cleric Mahmoud al-Sarkhi after clashes with his followers in the Shiite holy city of Karbala, 50 miles (80 kilometers) south of Baghdad In pictures: The rise of Isis Iraqi refugees An Iraqi woman holds her exhausted son as over 1000 Iraqis who have fled fighting in and around the city of Mosul and Tal Afar wait at a Kurdish checkpoint in the hopes of entering a temporary displacement camp in Khazair In pictures: The rise of Isis Iraqi refugees Displaced Iraqi women hold pots as they queue to receive food during the first day of the Islamic holy month of Ramadan, at an encampment for displaced Iraqis who fled from Mosul and other towns, in the Khazer area outside Irbil, north Iraq In pictures: The rise of Isis Isis fighters in Syria A militant Islamist fighter waving a flag, cheers as he takes part in a military parade along the streets of Syria's northern Raqqa. The fighters held the parade to celebrate their declaration of an Islamic "caliphate" after the group captured territory in neighbouring Iraq In pictures: The rise of Isis Isis fighters in Syria Isis fighters wave flags as they take part in a military parade along the streets of Syria's northern Raqqa province Reuters In pictures: The rise of Isis Isis fighters in Syria Isis fighters travel in a vehicle as they take part in a military parade along the streets of Syria's northern Raqqa province In pictures: The rise of Isis Isis fighters in Syria Fighters from the Isis group during a parade with a missile in Raqqa, Syria. Militants from an al-Qaida splinter group held a military parade in their stronghold in northeastern Syria, displaying U.S.-made Humvees, heavy machine guns, and missiles captured from the Iraqi army for the first time since taking over large parts of the Iraq-Syria border In pictures: The rise of Isis Isis fighters in Syria Isis fighters during a parade in Raqqa, Syria In pictures: The rise of Isis Isis fighters in Syria Fighters from the Isis group during a parade in Raqqa, Syria. Militants from the splinter group held a military parade in their stronghold in northeastern Syria, displaying U.S.-made Humvees, heavy machine guns, and missiles captured from the Iraqi army for the first time since taking over large parts of the Iraq-Syria border In pictures: The rise of Isis Isis fighters in Syria Isis fighters hold a military parade in their stronghold in northeastern Syria In pictures: The rise of Isis Isis fighters in Syria Isis fighters during a parade in Raqqa, Syria In pictures: The rise of Isis Isis fighters in Syria A member loyal to the Isis waves an Isis flag in Raqqa In pictures: The rise of Isis Iraq crisis Iraqi anti-government gunmen from Sunni tribes in the western Anbar province march during a protest in Ramadi, west of Baghdad. The United Nations warned that Iraq is at a "crossroads" and appealed for restraint, as a bloody four-day wave of violence killed 195 people. The violence is the deadliest so far linked to demonstrations that broke out in Sunni areas of the Shiite-majority country more than four months ago, raising fears of a return to all-out sectarian conflict In pictures: The rise of Isis Iraq crisis Iraqi security forces hold up a flag of the Isis group they captured during an operation to regain control of Dallah Abbas north of Baqouba, the capital of Iraq's Diyala province, 35 miles (60 kilometers) northeast of Baghdad In pictures: The rise of Isis Isis fighters in Iraq Isis fighters parade in the northern city of Mosul In pictures: The rise of Isis Iraq crisis Volunteers, who have joined the Iraqi army to fight against the predominantly Sunni militants from the radical Isis group, demonstrate their skills during a graduation ceremony after completing their field training in Najaf In pictures: The rise of Isis Iraq crisis Kurdish Peshmerga troops fire a cannon during clashes with militants of the Isis group in Jalawla, Diyala province In pictures: The rise of Isis Lieutenant General Qassem Atta speaks during a press conference Iraqi Prime Minister's security spokesman, Lieutenant General Qassem Atta speaks during a press conference about the latest military development in Iraq, in the capital Baghdad. Iraqi forces pressed a campaign to retake militant-held Tikrit, clashing with jihadist-led Sunni militants nearby and pounding positions inside the city with air strikes in their biggest counter-offensive so far In pictures: The rise of Isis A police station building destroyed by Isis fighters An exterior view of a police station building destroyed by gunmen in Mosul city, northern Iraq. Iraq's new parliament is expected to convene to start the process of setting up a new government, despite deepening political rifts and an ongoing Islamist-led insurgency. Iraqi President Jalal Talabani issued a decree inviting the new House of Representatives to meet and form a new government In pictures: The rise of Isis Isis fighters in Iraq Smoke billows from an area controlled by the Isis between the Iraqi towns of Naojul and Tuz Khurmatu, both located north of the capital Baghdad, as Iraqi Kurdish Peshmerga forces take part in an operation to repel the Sunni militants In pictures: The rise of Isis Iraqi refugees An elderly Iraqi woman is helped into a temporary displacement camp for Iraqis caught-up in the fighting in and around the city of Mosul in Khazair In pictures: The rise of Isis Iraqi refugees An Iraqi Christian woman fleeing the violence in the village of Qaraqush, about 30 kms east of the northern province of Nineveh, cries upon her arrival at a community center in the Kurdish city of Arbil in Iraq's autonomous Kurdistan region In pictures: The rise of Isis Iraqi refugees An Iraqi woman, who fled with her family from the northern city of Mosul, prays with a copy of the Quran AP In pictures: The rise of Isis Isis fighters in Iraq The body of an Isis militant killed during clashes with Iraqi security forces on the outskirts of the city of Samarra Reuters In pictures: The rise of Isis Iraq crisis Iraqi civilians inspect the damage at a market after an air strike by the Iraqi army in central Mosul EPA In pictures: The rise of Isis Iraq crisis Members of the Al-Abbas brigades, who volunteered to protect the Shiite Muslim holy sites in Karbala against Sunni militants fighting the Baghdad government, parade in the streets of the city AP In pictures: The rise of Isis Iraq crisis Shia tribesmen gather in Baghdad to take up arms against Sunni insurgents marching on the capital. Thousands have volunteered to bolster defences AFP/Getty In pictures: The rise of Isis Iraq crisis A van carrying volunteers joining Iraqi security forces against Jihadist militants. Prime Minister Nuri al-Maliki announced the Iraqi government would arm and equip civilians who volunteered to fight AFP/Getty In pictures: The rise of Isis Iraq Fighters of the Isis group parade in a commandeered Iraqi security forces armored vehicle down a main road at the northern city of Mosul In pictures: The rise of Isis Iraq An Islamist fighter, identified as Abu Muthanna al-Yemeni from Britain (R), speaks in this still image taken undated video shot at an unknown location and uploaded to a social media website. Five Islamist fighters identified as Australian and British nationals have called on Muslims to join the wars in Syria and Iraq, in the new video released by the Isis In pictures: The rise of Isis Iraq Al-Qa’ida inspired militants stand with captured Iraqi Army Humvee at a checkpoint belonging to Iraqi Army outside Beiji refinery some 250 kilometers (155 miles) north of Baghdad. The fighting at Beiji comes as Iraq has asked the U.S. for airstrikes targeting the militants from the Isis group. While U.S. President Barack Obama has not fully ruled out the possibility of launching airstrikes, such action is not imminent in part because intelligence agencies have been unable to identify clear targets on the ground, officials said In pictures: The rise of Isis Iraq Militants attacked Iraq's main oil refinein Baiji as they pressed an offensive that has seen them capture swathes of territory, a manager and a refinery employee said In pictures: The rise of Isis Iraq Militants from the Isis group parading with their weapons in the northern city of Baiji in the in Salaheddin province In pictures: The rise of Isis Iraq A smoke rises after an attack by Isis militants on the country's largest oil refinery in Beiji, some 250 kilometers (155 miles) north of the capital, Baghdad. Iraqi security forces battled insurgents targeting the country's main oil refinery and said they regained partial control of a city near the Syrian border, trying to blunt an offensive by Sunni militants who diplomats fear may have also seized some 100 foreign workers In pictures: The rise of Isis Iraq Militants of the Isis group stand next to captured vehicles left behind by Iraqi security forces at an unknown location in the Salaheddin province. For militant groups, the fight over public perception can be even more important than actual combat, turning military losses into propaganda victories and battlefield successes into powerful tools to build support for the cause In pictures: The rise of Isis Iraq An injured fighter (C) from the Isis group after a battle with Iraqi soldiers at an undisclosed location near the border between Syria and Iraq In pictures: The rise of Isis Iraq Fighters from the Isis aiming at advancing Iraqi troops at an undisclosed location near the border between Syria and Iraq In pictures: The rise of Isis Iraq Fighters from the Isis group taking position at an undisclosed location near the border between Syria and Iraq In pictures: The rise of Isis Iraq Fighters from the Isis group inspecting vehicles of the Iraqi army after they were seized at an undisclosed location near the border between Syria and Iraq In pictures: The rise of Isis Iraq One Iraqi captive, a corporal, is reluctant to say the slogan, and has to be shouted at repeatedly before he obeys Sky News In pictures: The rise of Isis Iraq Iraqi captives held by the extremists Sky News In pictures: The rise of Isis Iraq Iraqi captives held by the extremists Sky News In pictures: The rise of Isis Iraq Militants of the Isis group force captured Iraqi security forces members to the transport In pictures: The rise of Isis Iraq Militants of the Isis group transporting dozens of captured Iraqi security forces members to an unknown location in the Salaheddin province ahead of executing them In pictures: The rise of Isis Iraq A major offensive spearheaded by Isis but also involving supporters of executed dictator Saddam Hussein has overrun all of one province and chunks of three others In pictures: The rise of Isis Iraq Militants of the Isis group executing dozens of captured Iraqi security forces members at an unknown location in the Salaheddin province In pictures: The rise of Isis Iraq Isis militants taking position at a Iraqi border post on the Syrian-Iraqi border between the Iraqi Nineveh province and the Syrian town of Al-Hasakah In pictures: The rise of Isis Iraq Isis rebels show their flag after seizing an army post AFP/Getty Images In pictures: The rise of Isis Iraq Isis militants waving an Islamist flag after the seizure of an Iraqi army checkpoint in Salahuddin Getty Images In pictures: The rise of Isis Iraq Demonstrators chant slogans as they carry al-Qa’ida flags in front of the provincial government headquarters in Mosul, 225 miles (360 kilometers) northwest of Baghdad. In the week since it captured Iraq's second-largest city, Mosul, a Muslim extremist group has tried to win over residents and has stopped short of widely enforcing its strict brand of Islamic law, residents say. Churches remain unharmed and street cleaners are back at work

But that is not the crucial difference. Where the Saudis tend to support restrictive strong-man regimes like their own across the Arab world, the Qataris, throughout the Arab Spring, have backed grassroots Islamists such as the Muslim Brotherhood in Egypt. The tiny country has given $200m to Hamas, which is constantly firing low-grade rockets from Gaza into Israel. It is more open-minded towards the Shia Muslims of Iran and Hezbollah in Lebanon, whom the Saudis see as enemies. It even has good relations with the Taliban.

And it has been the biggest funder of the Syrian rebels, with sources in Doha estimating it has spent as much as $3bn in Syria alone – 70 military cargo flights were sent in the past two years – in an attempt to develop networks of loyalty among rebels and set the stage for Qatari influence in a post-Assad era. Riyadh sees its tiny neighbour – "300 people and a TV channel", as one Saudi prince dismissively said – as a troublesome and dangerous gadfly.

The result of all this is that Qatar and Saudi have channelled funds, arms and salaries to different groups in Syria. Until last year they were creating rival military alliances and structures. But their efforts at discrimination have been in vain. On the ground the rebel groups have been porous, with personnel switching to whichever was the best supplied. Fighters grew their beards or shaved them off to fit the ideology of the latest supplier. Many moved to whichever group was having most success on the battlefield. Key Qataris and Saudis felt it didn't matter as long as the result was the fall of Assad. But eventually two of the most extreme groups began to dominate, and eventually one of them, Jabhat al-Nusra, lost dominance to the other, Isis – the ruthless and potent force which has declared itself the Islamic State.

Only towards the end have the funders realised the error of their strategy. The Qatar government has stemmed the flow of funds. At first it believed it could change the ideology of those it funded once the war against Assad was over.

But now it realises it was creating a sleeping monster, as the Saudis had done when they financed the Taliban to fight the Soviets in the 1980s. In April, the Saudis sacked the head of their intelligence services, Prince Bandar bin Sultan, who had been responsible for the details of arming the Syrian rebels. His blunders led to the massive empowerment of the kind of grassroots Islamism which is the greatest threat to the Saudi claim to be the leader of global Islam because of its vast wealth and its custodianship of the holy city of Mecca.

They have left it too late. The genie is out of the bottle. Some funds continue to flow from wealthy Qatari individuals and from conservative Saudi preachers collecting funds through their television shows. But the terrorists of the Islamic State, who were earning $8m a month from a Syrian gas field where they have established robust logistical lines, have added a further $1m a day from the half dozen Iraqi oilfields they have seized. Worse still, the conflict in Iraq has solidified into religiously defined ethnic identity lines.

As Washington has now realised, the Islamic State will have to be stopped militarily. But real progress to re-civilise the cradle of civilisation which was Mesopotamia will require countries such as Saudi Arabia and Qatar – as well as the West, Iran, Israel and Syria – to make some hard decisions about the hierarchy of evil and where their greatest enemy lies.