Complex sentence: Countries need a public justification for attacking another country, both to galvanize internal support for the war, and to gain the support of potential allies.
Split into simpler sentences: Countries need a public justification for attacking another country. This justification is needed to galvanize internal support for the war, as well as gain the support of potential allies.