There are laws about when you can shoot someone during warfare. For example, you need to be a uniformed soldier, in most cases, of a party to an active conflict. The declaration of war and your uniform make the homicide legal.

The US has not declared war and these aren't acts of war.

> The declaration of war and your uniform make the homicide legal.

Declarations of war have very little international importance any more, since the recognition of the crime of aggression; either you are engaging in aggressive war, which a declaration does nothing to legitimize, or you are engaging in defensive war against an aggressor, where it is the aggression, not any declaration, that gives your fighting legitimacy.