A community has a greater obligation to protect lives than an individual. Therefore, it must set up a medical system to care for the sick, a police force to prevent crime, and a fire department to fight fires. Unlike private individuals, medical professionals and first responders must do their job even when it involves endangering themselves. Since these people are public servants, they must act in accordance with official guidelines, including risking their lives when their rescue work will most likely succeed. The calculation involved in following procedure is that overall, human lives are saved despite the risks assumed by the public servants.
The obligations of soldiers and first responders are even greater during a defensive war. They must follow military orders even if chances are they will die. They must sacrifice their lives to save the nation. In other words, in a state of war, the calculation is on a national scale. Only this type of calculation will preserve the nation and ensure the lives of the maximum number of citizens.