Give the main reason why the European countries formed alliances before the outbreak of the First World War

Give the main reason why the European countries formed alliances before the outbreak of the First World War