Alliance formation and national security