The fight against the Islamic militant group ISIS has alarmed so many governments and religious groups that it has been turning old enmities into an awkward tangle of alliances, most of them not publicly acknowledged.
The most recent example came this weekend with the rescue of the Iraqi town of Amerli, a town that had held off a besieging ISIS army for more than a month. That siege was finally broken with a combination of U.S. airstrikes, Iraqi and Kurdish army units, and a Shiite militia.
The U.S. bombing runs were helping a militia that had doggedly battled U.S. forces in the years after the overthrow of Saddam Hussein. The militia is also supported by Iran and, according to the Associated Press, was being advised by officers of Iran's elite Revolutionary Guard.
The U.S. has repeatedly said that is not coordinating its efforts with Iran.
President Obama has ordered surveillance flights over Syria to track ISIS, which has its capital, Raqqa, in Syria. Obama has not authorized airstrikes against ISIS in Syria, but they would inevitably benefit the Assad regime.
Iran hasn't been the only antagonist of the U.S. to come to the aid of America's ally, Iraq. Shortly after ISIS shocked the world by overrunning much of northern Iraq, Russia sent several warplanes and helicopters to Iraq, putting the U.S. and Russia on the same side in Iraq while having a political confrontation over Ukraine.
In addition, many Iraqi Shiites in recent years have gone to fight in Syria to defend the regime of President Bashar al-Assad, whose government U.S.-backed rebels have been trying to topple. Many of those Iraqis who opposed U.S. goals in Syria are now returning home to join Shiite militias to fight ISIS.
Within the Islamic world, Iran, America's enemy, and Saudi Arabia, a U.S. ally, have jockeyed for dominance, often through allied militias. Iran is a Shiite country while Saudi Arabia is run by a Sunni monarchy.
One of Iran's most powerful allies is the Lebanese militia Hezbollah, which has sent forces into Syria to support Assad. Saudi Arabia has been funneling money and weapons to Syrian rebels.
Now, Hezbollah is poised to battle ISIS in defense of Assad -- and all three are traditional enemies of the U.S.
Possibly more surprising is Saudi Arabia aligned with Iran in its fear that ISIS could destabilize the region and threaten the influence of both governments.