There was a mixture of intentions and some of them commendable. Tony Blair particularly was generally concerned with giving the people of Afghanistan a better life and in some part we did do that -- admittedly at enormous cost. The problem now is that we are quite possibly left less secure and definitely have lost credibility with both friends and foe.
Jumping from 9/11 to "war on terror" was probably a mistake and rather treating it as a criminal action would have been better. Easier to say now of course.