Over a long period of time, shared experiences and cooperative activity of many different kinds shape a common life. "Contract" is a metaphor for a process of association and mutuality, the ongoing character of which the state claims to protect against external encroachment. The protection extends not only to the lives and liberties of individuals but also to their shared life and liberty, the independent community they have made, for which individuals are sometimes sacrificed. The moral standing of any particular state depends upon the reality of common life it protects and the extent to which the sacrifices required by that protection are willingly accepted and thought worthwhile. If no common life exists, or if the state doesn't defend the common life that does exist, its own defense may have no moral justification.
"Just and Unjust Wars", Michael Walzer, 1977, p. 54
This quote is interesting in two ways; one, it shines an entirely different light on the idea of "failed states", (though the author didn't seem to think of them). "Failed states" are probably rather countries in which society lacks cooperative activity to sustain a functional "state". This in turn would mean that outside intervention to establish a functional state top-down would fail as long as the spirit of cooperation doesn't grow in the country.
The other way this quote is most interesting is the final part: Whether the defence of a country has moral justification. This isn't exactly mirrored by the (lack of) moral justification of invasion, but it's close.
Philosophy isn't simple, but still largely unrestrained and this is an example where conclusions from philosophy may be wrong in real life.
Who determines whether a state lacks moral justification of itself or for its defence? Who determines whether that state is so bad, so evil, that invasion (intervention) is fine? Or more directly; the pro-intervention crowd and media may paint a picture of a country persecuting a minority, even committing genocide.
Should we trust them?
All too often, such and lesser assertions were wrong, if not outright lies by warmongers. The horror stories about Kosovo in 1999 were mostly lies as well - very little was proved ex post, very much was disproved.
Mr. Walzer used the analogy to the case of an individual very often in the quoted book. An individual has a right to self-defence, a country (presumably) has also a right to self-defence.
Now looking at the individual level, said same individual usually has the right to be judged innocent until found guilty, and more importantly it is usually only to be found guilty if there's no doubt about the guilt any more. In dubio pro reo.
Most if not all countries have this rule codified because it's quite universally believed to be worse to risk harming an innocent than to risk to let a guilty one go.
This, too, could be applied to the level of countries. The result would be a very, very high bar for invasions even if and when very extreme accusations were made. Very extreme accusations are being made to launch just about every war, after all. They would become less frequent if we denied them power by not being swayed to go to war by very extreme accusations, but also demanded de facto certainty about what's happening.