 During the course of World War 2 Wagner became head of the Operational Department of the naval staff.At the end of the conflict, Wagner, together with the supreme commander of the Kriegsmarine, Hans Georg von Friedeburg, was present and a signatory to the surrender of the German forces in northern Germany at Lüneburg Heath on 4 May 1945 to the British Commander-in-Chief, General Bernard Montgomery.Wagner subsequently gave testimony on 13 and 14 May 1946 at the Nuremberg Trials.