After defeating the Danes at Humlebæk and the Russians at Narva in 1700, Charles XII of Sweden turned his attention towards his third enemy, Augustus II of Poland and Saxony, defeating him in a fierce battle at the Crossing of the Düna in 1701. The same year, he launched an invasion of the Polish–Lithuanian Commonwealth to dethrone Augustus II and install a candidate acceptable to Sweden. After the Swedes' seizure of Warsaw, Kraków and Sandomierz and another defeat for Augustus II at the Battle of Kliszów, a growing number of Polish-Lithuanian magnates switched sides, in favour of Charles XII.