The latter award was possible because Bavaria became a secret ally of France against Austria. When the War of the Third Coalition broke out in September 1805, the Bavarian army withdrew north to the Main River in response to the Austrian invasion. Deroy commanded a corps of two divisions, including his own and Wrede's. The French armies soon obliterated the Austrian army of Karl Mack von Lieberich at the Battle of Ulm on 20 October. This freed the Bavarian contingent to operate against the Tyrol. On 1 November, Bavarian Oberst Pompei successfully rushed several positions near Lofer which lies southwest of Salzburg. Encouraged, Deroy ordered an attack on the Strub Pass, eight kilometers west of Lofer. The position was defended by Franz Xaver Saint-Julien's 1,500-man Austrian brigade with the support of local Tyrolean militia and sharpshooters. The assault ended in a bloody repulse, with 1,200 to 1,800 Bavarians out as casualties, including Deroy wounded. Saint-Julien only lost 200 men and one cannon.