On 15 April, he fought at the Battle of Rain commanding the Liga cavalry. On 17 April, the retiring Tilly suggested Scharffenstein as his successor in the command of the Liga troops. Scharffenstein assumed the position temporarily, however Maximilian I, Elector of Bavaria replaced him with Johann von Aldringen, after Wallenstein protested the decision going as far as threatening to quit if Scharffenstein was appointed. Scharffenstein's distaste for Wallenstein grew into an open hatred, prompting him to defect to the Swedes through secret negotiations with Bernard in May 1633. He surrendered Ingolstadt to the Swedes the moment he deemed his other rival Aldringen (who was fighting in Swabia) was most vulnerable. The Bernardines arrived too late, ruining his plan and forcing him to flee to Bernard. As a Swedish field marshal he fought side by side with Bernard in Bohemia and the Upper Palatinate, before advancing to Franconia at the head of 5,000 men. On 5 November 1634, he commanded the Swedish right flank at the Battle of Nördlingen opposite Johann von Werth. The Swedes were defeated, 4,000 men fell into captivity including Scharffenstein and Gustav Horn, Count of Pori. He was taken to Vienna where he managed to escape and fled to Silesia. He was seized again and brought back to Vienna where he was convicted of treason and executed on 26 July 1635.