Michael Doran is a senior fellow at the Saban Center for Middle East Policy at the Brookings Institution. Max Boot is a senior fellow at the Council on Foreign Relations.

The growing disaster in Iraq has triggered anguished debate over two fundamental questions: What went wrong? And what do we do about it?

Surprisingly, many people who disagree vehemently about the former question (in particular, whether President George W. Bush or President Obama is more to blame) agree on the latter. Thus Sen. Lindsey O. Graham (R-S.C.), who has consistently attacked the Obama administration for its foreign policy, suggests that the United States should work with Iran to counter the rapid advance of the Islamic State of Iraq and Syria (ISIS). That idea was also advanced by Secretary of State John F. Kerry, who said Monday that the administration is “open to discussions” with Tehran and would “not rule out” cooperation in Iraq.

It’s sometimes true that very different countries can cooperate against a common enemy, as the United States and Soviet Union did during World War II. But the suggestion of a united U.S.-Iran front is more reminiscent of the wishful thinking among conservatives who argued in the 1930s that Britain and the United States shared a common interest with Nazi Germany in countering communism. The idea that the United States, a nation bent on defending democracy and safeguarding stability, shares a common interest with the Islamic Republic of Iran, a revolutionary theocracy that is the No. 1 state sponsor of terrorism in the world, is as fanciful as the notion that Neville Chamberlain and Adolf Hitler could work together for the good of Europe.

While it’s true that Iran is run by Shiite fundamentalists and ISIS is a Sunni organization, the rise of ISIS provides Tehran with multiple benefits. For one thing, it makes Prime Minister Nouri al-Maliki and the Shiites of Iraq ever more dependent on Iranian protection. For another, ISIS’s frightening rise makes the United States more likely to compromise with Iran.

Iranian President Hassan Rouhani speaks during a press conference in Tehran, Iran, Saturday, June 14, 2014. (Vahid Salemi/AP)

We have grown accustomed to Pakistan playing both arsonist and fireman at the same time — sheltering Osama bin Laden and supporting jihadist groups while winning aid from Washington by portraying itself as a partner in the war against terrorism. Iran is adept at playing a similar game, only instead of aid it is likely hoping for a further relaxation of Western sanctions and a sweeter deal on its nuclear program.

Indeed, the non-jihadist Syrian opposition insists that ISIS is a creation of Iran. In typical Middle East fashion, the Syrians overstate the case, but there is much evidence that Iran and its Syrian allies have cooperated with ISIS. Don’t forget that ISIS (then known as al-Qaeda in Iraq) was launched by the late Abu Musab al-Zarqawi, who, U.S. intelligence believes, received aid, shelter and financial support from Iran after he was chased out of Afghanistan by U.S. forces in 2001. Zarqawi received even more support from Iran’s close ally, Syria, which allowed its territory to be used to supply al-Qaeda in Iraq with a steady stream of foreign fighters.

As recently as 2012, the Treasury Department identified Iran as supportive of ISIS, which has reportedly grown fat in no small part due to deals with the Assad regime for oil from wells under its control. That’s right. According to Western intelligence sources, Assad, Iran’s top client in the region, has a business partnership with ISIS even though ISIS has been fighting his regime. (Assad’s motives are varied, but among them is thought to be a desire to boost jihadist fighters so as to discredit the opposition in Western eyes.)

But even if we were to assume that Iran is truly ISIS’s implacable enemy, that doesn’t mean it would be a good idea for the United States to cooperate with Iran’s Revolutionary Guard Corps — an organization that has been responsible for attacks against U.S. targets stretching back more than 30 years. We have seen in Syria how Iranian-backed forces go about putting down a Sunni-led insurgency. More than 150,000 people have already been killed in the Syrian civil war and millions more uprooted from their homes. The Assad regime has become notorious for dropping “barrel bombs” on civilians and even using chemical weapons.

Iranian-backed groups used equally brutal methods in Iraq during the height of the fighting after al-Qaeda’s bombing of the Samarra mosque in 2006. Shiite extremists became notorious for kidnapping and torturing Sunnis. Those same groups stand on the front lines today of Shiite resistance to ISIS.

The United States would be making a historic error if it were to assist such an Iranian-orchestrated ethnic-cleansing campaign with air power or even with diplomatic support. Not only would this be morally reprehensible, it would be strategically stupid because it would convince the region’s Sunni Muslims that the United States is siding against them with Iran and its regional allies. This could lead Sunni states such as Saudi Arabia, Turkey and the United Arab Emirates to support extremists such as ISIS, further feeding the growing sectarian conflict across the region.

Instead, the United States should develop a coalition of our traditional allies dedicated to building up an alternative to al-Qaeda in the vast battlefield now stretching from Baghdad to Damascus. Such a policy will require training and equipping non-jihadist fighters of the Free Syrian Army while working to pull the Iraqi government out of Iran’s orbit. The latter goal will probably require a strenuous effort to scuttle Maliki’s bid for a third term in favor of a more inclusive leader. The United States should also work covertly, as it did during the 2007-2008 surge, to destroy Iranian networks in Iraq.

This is, to be sure, an ambitious plan, but nothing less than the future of the Middle East is at stake. If current trends continue, the United States will be faced with a nuclear Iran standing off against a Sunni Arab world in which al-Qaeda is a more important player than ever and in which at least one state (probably Saudi Arabia) acquires nuclear weapons of its own. Faced with such a prospect, we should not be pursuing a chimerical alliance with Iran. We don’t have to, and should not, ally with one group of terrorists to fight another.