There's one historical fact that explains a lot about the Middle East. 40 years ago there was a war between Iraq, led by Saddam Hussein, and Iran, led by Ayatollah Khomeini (who shares last name with a current Ayatollah).
So, USA supported Hussein - led Iraq. And Israel supported Ayatollah - led Iran
https://en.m.wikipedia.org/wiki/Iran%E2%80%93Iraq_War
Middle East is all about flip flopping and situational alliances, that can be an opposite of what was a decade ago. It's a very complicated money-driven chess game, where things like history, religion, ethnicity are used as excuses and propaganda, but are essentially a veil for real motivations.