Political alliances are constantly shifting. The US was allied with the Soviet Union in WWII. Then the USSR became the US's arch-enemy in the Cold War. The Osama bin Laden that the US was subsidizing in the 1980s was at that time fighting against the Soviet army in Afghanistan.
Another example of shifting alliances: During the Iran vs. Iraq war, the US and other Western countries were subsidizing Saddam Hussein, since Iraq was considered the lesser of two evils (they had not taken US diplomats hostage as the Iranians had). Everyone looked the other way when the Iraqis used chemical weapons on the Iranians. When Iraq invaded Kuwait, they became an enemy of the US because they were threatening US oil suppliers. At the present time, the Iraqi government is again a friend of the US. In a few years, things could change again.
Another example of shifting alliances: During the Iran vs. Iraq war, the US and other Western countries were subsidizing Saddam Hussein, since Iraq was considered the lesser of two evils (they had not taken US diplomats hostage as the Iranians had). Everyone looked the other way when the Iraqis used chemical weapons on the Iranians. When Iraq invaded Kuwait, they became an enemy of the US because they were threatening US oil suppliers. At the present time, the Iraqi government is again a friend of the US. In a few years, things could change again.