Most of the military and people who ran Iraq were Sunni and the countries population is majority Shia and aligned with Iran
The only thing keeping the Sunni military and managerial class safe from Shia led purges and worse was the United States military presence.
Once our military left the country, the Sunnis knew that the Iranian influenced Shia proxies would be at their throats
This led many Iraqi Sunni officers to conclude that bad as al Qaeda had been in Iraq, they were preferable to an Shia regime that was a puppet of Iran's mullahs
The Iraqi military leadership essentially handed Iraq and all of the American military equipment they were armed with to al Qaeda ( ISIS) without putting up much of a fight and often simply abandoned their troops ( who were often Shia) in the field
Obama knew exactly what he was doing when he exited Iraq
The whole thing stinks to high heaven. Frankly, I don't trust any bastard in our government who had anything to do with the Iraq invasion.