On 21 June 1941, Fomin wanted to travel to Daugavpils to bring his family to Brest, but he failed to get a train ticket due to a big crowd of people at the railway station. On 22 June, Fomin was at the Brest Fortress, when the Wehrmacht started the war codenamed Operation Barbarossa. As the only higher commander present he took over the command of the group of Soviet soldiers that defended the Kholm Gate.