I think they were. You have to look at the situation the US was in a the time. Long quagmires are politically untenable in the US and Afghanistan is the most tactically difficult terrain in the history of the world. Additionally my enemies really aren't states so much as a political movement who survives largely through the tacit support of the surrounding population. I need an easy war and I need a place to kill terrorists and expose the indifferent to the effects of their violence. Whether or not that was the stated purpose that was the effect of the Iraq war. I would argue that excluding the real dollar cost it was probably one of the most successful wars in American history.
As for Libya well to be honest it is no longer in America's interest to ensure stability in the middle east. In fact given the long reach of unhappy middle eastern people its our job to make sure they express that unhappiness right at home. The Libyan people are doing that right now.