The laws of war define the 'proper' conduct of warfare. They consist of rules intended to help minimize brutality toward civilians and prisoners of war, as well as rules making a future peace easier to achieve. The Geneva conventions provide a widely accepted expression of the laws of war.
Well-known examples of such laws include the prohibition on attacking doctors or ambulances displaying a Red Cross. It is also prohibited to fire at a person or vehicle bearing a white flag, since that indicates an intent to surrender or a desire to communicate. In either case, the persons protected by the Red Cross or white flag are expected to maintain neutrality, and may not engage in warlike acts.
Other examples of the laws of war address the acceptance of surrender and the treatment of prisoners of war; the avoidance of atrocities; the prohibition on deliberately attacking civilians; and the prohibition of certain inhumane weapons. Impersonating soldiers of the other side by wearing the enemy's uniform is also strictly forbidden, as is the taking of hostages.
Soldiers who break the laws of war are considered to lose all protections. For example, in World War II during the Battle of the Bulge, German SS troops put on American uniforms and impersonated American troops in order to surprise and kill American soldiers behind their own lines. Some of these Germans were captured and immediately executed even though they had surrendered. Even though this did not constitute an atrocity according to the laws of war, the SS troops had lost all protections of the laws of war by violating the laws of war.
Spies and terrorists are not protected by the laws of war; they are subject to civilian laws (if any) for their acts and in practice are often subjected to torture and execution. The laws of war neither approve nor condemn such acts, which fall outside their scope. Countries that have signed the UN Convention Against Torture have committed themselves not to torture captured terrorists.