A military alliance is a formal agreement between nations concerning national security. Nations in a military alliance agree to active participation and contribution to the defense of others in the alliance in the event of a crisis. In the event a nation is attacked, members of the alliance are often obligated to come to their defense regardless if attacked directly. In the aftermath of the Second World War military alliances usually behave less aggressively and act more as a deterrent. Military alliances differ from coalitions, which formed for a crisis that already exists.
According to a 2002 dataset of military alliances, there have been 538 alliance treaties from 1815 to 2003. The vast majority of the alliances involve commitments to come to the military support of one ally involved in war. The vast majority are defensive in nature.