Under international law, the act of spying, or espionage, describes an act of information gathering that is clandestine or takes place under false pretenses (API Art. 46).
International humanitarian law makes a distinction between intelligence activities and espionage . Intelligence activities describes the collection of information carried out by members of the armed forces in uniform, in order to assess the situation and determine the options open to the opponent. According to international humanitarian law, a member of the armed forces of a party to the conflict who, on behalf of that party and in territory controlled by an adverse party, gathers or attempts to gather information will not be considered as engaging in espionage if, while so acting, he is in the uniform of his armed forces (API Art. 46.2).
Some specific clauses concern information gathering in occupied territories. A member of the armed forces of a party to the conflict who is a resident of territory occupied by an adverse party and who, on behalf of the party on which he depends, gathers or attempts to gather information of military value within that territory shall not be considered as engaging in espionage unless he does so through an act of false pretenses or deliberately in a clandestine manner. Moreover, such a resident shall not lose his right to the status of prisoner of war and may not be treated as a spy unless he is captured while engaging in espionage (API Art. 46.3). A member of the armed forces of a party to the conflict who is not a resident of territory occupied by an adverse party and who has engaged in espionage in that territory shall not lose his right to the status of prisoner of war and may not be treated as a spy unless he is captured before he has rejoined the armed forces to which he belongs (API Art. 46.4).
A spy caught in the act is assimilated into the category of saboteur and cannot benefit from the status of prisoner of war. The spy must nevertheless be treated with humanity and must not be punished without a fair and regular trial (GCIII Art. 5).
Customary international humanitarian law prescribes that in the context of an international armed conflict, combatants who are captured while engaged in espionage do not have the right to prisoner-of-war status. They may not be convicted or sentenced without previous trial (Rule 107 of the 2005 ICRC customary IHL study).
For Additional Information: Dinstein, Yoram. The Conduct of Hostilities under the Law of International Armed Conflict . Cambridge: Cambridge University Press, 2004, esp. 208–13.