In this case it was. Absolutely. One of the duties of a government is to control what goes on in its territory. Legally we had an iron-clad casus belli.
Legally, the UN charter and thus US law makes it clear invading another country can be done in self-defense or by approval of the security council. Neither of those conditions were met. Legally, you're talking nonsense. The U.S. government knew this. They labelled Taliban troops terrorist-supporters rather than soldiers so that they could ignore the law. Invading a country and bombing big lumps of it into oblivion and then occupying it for a decade because you fear a handful of non-state actors who might or might not be inside it; both illegal and fucking ridiculous, and far more damaging to the US than a grown-up response would have been.
>Legally, the UN charter and thus US law makes it clear invading another country can be done in self-defense or by approval of the security council. Neither of those conditions were met.
Nonsense. That's as clear a case of self defense as you're going to find.