殉国 is solemn and formal, used in history writing and on memorials for soldiers and officials who died defending their country. For a police officer or firefighter who dies on duty the word is
殉职; for someone who dies for a cause or in a disaster,
殉难.