NATO isn't a defensive alliance, period. It is a mutual security pact.
Here is the actual treaty:
https://www.nato.int/cps/en/natolive/official_texts_17120.ht...
Article 4 is quite deliberately vaguely worded. And the treaty also explains why NATO only got involved in Libya after the UN requested it to.