Earlier this week, outside Washington, the Obama team hosted senior military leaders from nations pledged to help fight the so-called Islamic State, in a mission the Pentagon is now calling Operation Inherent Resolve. Representatives from 21 of the 60-odd countries appeared. Everyone, of course, was too polite to inquire about the embarrassing number of absentees. Nor did they comment on how little these partners have contributed to the war effort thus far, or on the fact that no new serious help has been promised. Least surprising of all was the absence of the only two nations that could help fight the jihadis now and in a tangible form.

In the short term the only way to check ISIS, as the self-declared caliphate is widely known, is for the United States to work with Bashar Assad’s Syria, and with Iran. It is a tricky and perilous path, but there are no realistic alternatives.

In short, here’s why: First, air power alone can’t stop, let alone, defeat ISIS. Even those who now demand an escalation of the overly restrained U.S. air campaign don’t argue that it is a solution. Second, neither Iraq nor American-backed Syrian rebels can field viable ground forces, at least for some time. Just look at their performance to date and see if the U.S. can afford to pretend otherwise.

White House officials won’t publicly discuss the limited effectiveness of their air campaign because it’s the only action the U.S. and its partners can now agree to take. Privately, however, they understand well that missiles, drones, and bombs can help Kurdish forces near Kurdistan, damage some jihadi-controlled oil refineries, and keep the militants from massing forces and armor. But that’s about it.

The White House, however, does not grapple with the essentiality of good ground forces now. Instead, it resorts to its usual wishful thinking. The Iraqi army, the Obama team says, wouldn’t fight for Prime Minister Nouri al Maliki, but it will fight for a more responsive government. The solution was to depose Maliki, the sectarian Shiite prime minster, and to replace him with a more flexible Shiite who might accommodate the unhappy Sunnis and Kurds.

No such luck. The newly installed regime shows little sign of being able to cure Iraq’s political ills, and Iraqi troops have become no more effective. It is not even certain that they can or will defend Baghdad or the oil facilities to the south.

Neither can the Obama team shake its years-long rhetoric about salvation resting with equipping an army of Syrian democrats, the so-called moderate rebels. These rebels have formidable advocates in Washington, from Republicans like Sen. John McCain to the likes of Hillary Clinton and Leon Panetta, but these devotees are overlooking basic facts.

Factions within the Syrian National Coalition, the supposed overall leadership body for the rebels, haven’t been able to agree among themselves and exercise little oversight over rebel troops in the field. The rebels inside Syria, those whom Americans truly would like to help, are almost totally disorganized themselves. Their politics run from democratic to Islamic fundamentalist, and many have simply sold to the jihadis the very arms given to them by the U.S.

Washington should, in fact, undertake a careful long-term program to arm and train these rebels so that over time they will be strong enough to fight and/or bargain with the Alawite Shiites in Damascus. It makes no sense, however, for Obama to continue promising urgent delivery of hundreds of millions of dollars’ worth of arms to groups that could not possibly absorb them.

This rhetoric aside, the Obama team and the Pentagon know full well the limits of the rebels and are beginning to search out a realistic alternative. This foreign policy sleight of hand was revealed last month when Secretary of State John Kerry let slip America’s intention to “de-conflict” with Assad. One apparent result of these subtle moves is that Assad seems to be turning off his air-defense system when U.S. aircraft attack his territory. For its part, the U.S. hasn’t hit major oil fields under ISIS control. Presumably this is because Assad wants them working when he takes over again.

Only Assad’s Syria and Iran can and would provide plausible ground forces in short order. Turkey, the other possible partner, has shown itself to be more interested in checking its own Kurdish population than in fighting ISIS abroad. On paper, Assad’s army numbers over 100,000, and his air force contains around 300 jets. Even if his actual fighting force is half that, Syria’s is still the best positioned and most usable outfit among the neighboring Arab states. Iran’s forces are even more potent.

Assad has thus far proved cagey. He hasn’t made the defeat of ISIS his top priority. He remains zeroed in on the rebels, while brokering his own stolen oil internationally on behalf of the ISIS jihadis who took it. Recently, however, Assad has been signaling that he sees things differently, but he won’t turn his attention fully to ISIS without quiet assurances from the Americans—and probably the Russians, too—that this won’t disadvantage him against the rebels. Russia, brimming with unhappy, armed Muslims, is even more threatened by the existence of ISIS than the United States. Moscow could help facilitate cooperation between Syria, Iran, and the U.S., not because Vladimir Putin is kind-hearted, but because it is in his obvious interest.

Cooperating with Assad is also the only feasible way, at present, to lessen the humanitarian nightmare in Syria. Thus, the first condition for cooperation must be his agreement to respect humanitarian zones in rebel held areas linked to a mutual ceasefire. This arrangement would be without prejudice as to the ultimate resolution of Syria’s political crisis, but it could help resolve matters peacefully and permit both parties to focus on fighting the Islamic extremists.

As for Iran, its leaders, both reformists and hardliners, regard the Sunni Islamic State as a mortal threat to Shiite governments in Tehran, Damascus, and Baghdad. The Iranians have the military means and good reason to be effective partners; the ever-present risk is that their revolutionary ideology will run amok. If a deal can be arranged, Tehran’s ground forces should be restricted to Baghdad and southern Iraq. Going northward would antagonize Iraqi Sunnis, whom Washington and Baghdad are currently wooing. Luring those Sunnis back into a functioning Iraqi state will be a Herculean task, but, by and large, Iraqi Sunnis are not religious crazies and might be persuaded by tangible offers of considerable local autonomy.

The long-term strategic risks are clear: Iran and Assad’s Syria could emerge from this anti-jihadi alliance with much more power in the Mideast and beyond. No one needs to be reminded that the men in charge in Damascus and Tehran are really nasty guys. At the end of the day, however, both have been mainly self-protective powers. Assad has been more of a threat to his own people than to his neighborhood. Iran’s revolutionary propaganda, its backing of regional terrorist groups like Hezbollah and its nuclear program bear close watching, but underneath these are potential avenues for cooperation worth testing and pursuing. The potent shared interest in defeating ISIS is one such avenue.

Historically, Washington is not allergic to cooperation with devils. The U.S. allied with Stalin to fight Hitler. The U.S. has banded with the Arab Gulf states for decades, and no bunch of American “friends” has done more to damage American security than the likes of Saudi Arabia, Kuwait, the United Arab Emirates, and Qatar. For decades, their leaders have provided hundreds of millions of dollars in cash and arms to the very terrorists threatening the U.S and its partners across the globe.

Now is not the time for false virtue or moral absolutism. The working principle now has to be first threats first. And the first threat to American interests today is ISIS and its cohorts. If they gain a base of operations in the belly of the Mideast, they will intimidate nations around the world while launching terrorist attacks against those that remain resolute. They have to be hit very hard where they are and hit now—and there’s no way to do it other than working carefully, very carefully, with the devils we know.