 It's super simple. Any one country having to defend itself if attacked is going to face an existential threat. If they band together with other countries, they're more powerful. It's going to be easier or better in terms of defending themselves against an adversary. And because of that, it's less likely that they will be attacked.