It might look like it but it isn't really.
You are doing something for somebody with whom you feel an affinity.
For example, if you save your own child from a burning building, you are doing it because you are genetically programmed to protect your genes.
If you live in a small Welsh village which is attacked by Vikings, you fight to protect it for the same (but diluted) reason.
If you live in a country which is at war with another, the genetic pool you are defending is more remote from your own, but there is still an affinity (remember that your genetic programming is inbuilt and your brain does it to you without you working out a rational argument). Same thing if your religion is in conflict with another, or even a slightly different branch of the same religion. Or if you are a Serb and the other guy is a Croat. Or someone else's child is attacked by a tiger - you have more affinity with the child than with the tiger.