The Morality of Patriotism
The simplest form of moral behavior occurs when a man fights for his own survival. Of course it is selfish ... but selfishness is the bedrock on which all moral behavior starts and it can be immoral only when it conflicts with a higher moral imperative.
The next higher level is to work, fight, and sometimes die for your own immediate family. This is the level at which a mother or father dives into a flood to save a drowning child ... and it is still moral behavior even when it fails.
The next higher level is to work, fight, and sometimes die for a group larger than the unit family - an extended family, a herd, a tribe. (The traits of duty and loyalty.)
The next level in moral behavior higher is that in which duty and loyalty are shown toward a group of your kind too large for an individual to know all of them. We have a name for that. It is called 'patriotism.'
Behaving on a still higher moral level were the astronauts who went to the Moon, for their actions tend toward the survival of the entire race of mankind. As a direct result of what they did, it is now possible that the human race will NEVER die.
(Pacifists may contend that THEIR actions are on this highest moral level. They want to put a stop to war; they say so. They live in a world of fantasy. If the human race managed its affairs sensibly, we could do without war. Yes - and if pigs had wings, they could fly. I don't know what planet those pious pacifists are talking about but it can't be the third one out from the Sun. The seeds of war are everywhere; the conflicts of interest are real and deep, and will not be abolished by pious platitudes. The best we can hope for is a precarious balance of power among the nations capable of waging total war - while endless lesser wars break out here and there.)
Excerpted, and edited to condense. (Note: Heinlein is speaking of a Nation, not a State. The two might not be interchangeable.) Via The Pragmatics of Patriotism (by Robert Heinlein)