 After the Polish defeat he evaded being captured by the Germans and Soviets and joined the newly formed Związek Walki Zbrojnej (ZWZ), the biggest resistance organisation, that eventually transformed itself into the Home Army.From 1940 to 1943 he served as the head of the 3rd detachment (Operational) of the general staff.After 1943 he also served as the deputy chief of staff of the entire Home Army.