Why did European nations form alliances?

They believed that is would be easier to resist conquest if other nations would come to their aid if attacked.