Just a few points reacting to comments already made:
The US has ALWAYS been a target of these groups, even before we were "involved so heavily in the Middle East". The reason is because we have, historically at least, been a very strong ally of Israel. The vast majority (if not all) Muslim extremists have a very narrow end game, which is gain power, establish a caliphate, and rid the Earth of the Jewish race. Period.
That is a VERY unstable part of the world and a new democracy in its infancy cannot be expected to handle all the terrorists alone. Anybody with any sense knew this is exactly what would happen if we pulled out so prematurely. The fact that anyone is surprised is laughable. Especially considering the announcement of the exact timing of our final withdrawal. It is nothing more than common sense, awareness of the enemy and knowledge of history.
The biggest problem with the Iraq war was that we half-assed it. We wanted to limit the amount of boots we put there and kept increasing the amount little by little and it dragged on and on. The war mongers PREFER a long and drawn out war. The defense contractors make tons more money if you can drag it out for 10 + years. Realistically we could have gone in there strong and accomplished what we did in 20% of the time or less.
Finally , bad_luck asked: Do you really believe that we could go into the middle east and sort out the tribal and religious battles that have been going on for 4000 years in a reasonable amount of time and miraculously void the area of the sentiment that leads to terror groups?
The definition of a "reasonable amount of time" is something no one will agree on. How long did we keep a military base in Germany after WWII?
I don't think the goal was to "sort out" anything or "miraculously blah blah blah", but rather use our military presence to allow democracy to take root. (Kind of like having a teacher outside watching the kids at recess. The bullies are less apt to punch anyone in the face while the teacher is out there) We did not do that. Obama couldn't pull the troops out fast enough. AWESOME IDEA!