The US was right to invade Afghanistan, in order to eliminate the Afghan-gov't supported/permitted terrorist training camps. The US, NATO, and the UN are also right in their ongoing efforts to provide Afghanistan enough stability to create and maintain a government which is strong enough to maintain security within its own borders, which will allow the other sectors of the country to develop. It's not an easy thing to do, especially not in a broken country where some people live without technology. Think about that - no technology. Mud huts and fire, that's it for many of them, and for most of them outside the handful of major cities (which don't look like any city here in Canada).
There are people in Afghanistan living life in the same manner as people lived in the time of Christ. And that has nothing to do with war or terrorism; it is just a poor and isolated country and many parts of it have just never progressed. Try bringing a concept like democracy and gender equality to a place like that!! It's a tough job which will take decades of international effort, however the world is still making a well-thought out effort there and is spending billions of dollars to change Afghanistan.
Of course, there are numerous other places for terrorists to train, so all we're doing is treating the symptoms instead of the causes. And Iraq, well, I don't see how Iraq and 911 are connected.
So how do you treat the cause? I just don't know. And I can actually understand why some people thing we Westerners are heartless, selfish, unholy bastards. I sat at a Senators game in the Corel Center last week, surrounded by 19 413 other rich Westerners, all of us having spent $50 - $250 for a ticket, $5 bucks for each slice of pizza, $10.25 for each pint of beer, $4 for each pop, etc, and all of us wearing hundreds of dollars worth of clothing, and all of us having travelled there in cars that cost from $10K - $75K, full of gas worth $1 a litre, and living in ridiculously well-furnished, clean, safe, heated homes. And although I'm a selfish rich western pig myself, I thought about those poor bastards in Afghanistan, living in filth, shitting in the same river they drink out of, living a subsistence existence, and I thought about the dozens of other countries where people live like that, then I looked around me again at all the squandered wealth we enjoy, and I wholly understood why some people think that we're a bunch of selfish godless pigs. We're horrible to our fellow man.
So how do we prevent terrorism? Well as a staunch right-wing libertarian, it pains me to say that IN THEORY, we need to share our wealth and the means to generate it, with the rest of the world. I suppose the pure communists had it right - "from each according to his means to each according to his needs", all that crap. But we all know how well that little endeavour went over. It was probably a very noble experiment on paper, but as an actual system of government, it was doomed by human nature.
So I think the only way to solve terrorism is the slow painful process of bringing freedom and prosperity to the rest of the world, ideally through non-violent means such as the spread of economic prosperity (through capitalism?) and showing them that there are better ways of living. We would probably have to lower our standards of living to accomplish that though, and I doubt any of us (myself included) are willing to go too far down that road to help some starving Moldovan or Mali-an. We suck. So Plan B is to protect ourselves. How lame is that?
I suppose we should have spent the billions of dollars the US has used up in Iraq to build schools and police stations and hospitals and factories and ports in all the poor countries on earth, so they could make some money, build a house, put food on their tables, and buy tickets to soccer games.