Yes, that is normal practice for all major powers.
Mata Hari
The accused spy Mata Hari was executed by firing squad on October 15, 1917 at the age of 41. She was accused by France of spying for the Germans during World War I.
Germans started World War I in 1914 and World War II in 1939. Additionally, Germans initiated the Holocaust during World War II which led to the systematic genocide of six million Jews.
Every nation considers spying to be a crime, particularly during times of war. Their own spies are exempted, of course. It's only a crime if some other nation is doing it.
The Germans
the Germans
The Germans
To prevent them from spying or committing sabotage
Probably most Germans were hated. But them USA Germans might not have!
the Turks and the Germans
Horses and Americans
The Germans, Italians and Japanese