Under Article 5 of the NAT an attack on one signatory is an attack on all, hence the mutual defense pact. Therefore we are obligated to assist the US in afghanistan but not iraq, as Iraq was a war of aggression
It is very specific to the term "attack" and Afghanistan did not "attack" anybody. If it is loosely to be interpreted as terrorism, the why did we not attack Yemen, Somalia, Syria, Iran and Indonesia?
You reference is basically a play on words
An "attack" as defined by NATO is any attack on home soil of any NATO signatory. Afghanistan's government harbored a terrorist organization and refused to hand over several key figures that committed the attack. The UN approved of aggressive action against the taliban and it was unilaterally agreed that such a war was justified. The US did have a Causus Belli on all of the countries you mentioned if what you claim was true, however declaring war over bombings of embassies would be a rash overreaction and would unlikely to be approved by the UN or the NATO allies. Nevermind the fact that such small attacks are not worth the billions that cost to run a war. If America let 9/11 unavenged, how would you think that would affect the number of terrorist attacks that will be attempted against America? Are you seriously attempting to say that Afghanistan is an unjust war despite the reality of NATO, the UN's approval, and the 3000+ dead in the WTC?