With reinforcements from the Swedish mainland, the Swedish main army broke camp in June and marched south towards Riga to confront King Augustus II's Saxon and Russian troops. By 7 July the army was outside Riga. Charles XII and Rehnskiöld planned to cross the Daugava river right next to the city and assault Augustus II troops on the opposite shore. In the Swedish battle plan, drafted by Rehnskiöld, Carl Magnus Stuart and Erik Dahlbergh, the troops were ordered to collect landing boats near Riga and construct floating batteries. The batteries would convey infantry units across the river to establish a bridgehead. During the operation on 9 July, Stenbock assisted in the construction of a floating bridge to allow the cavalry to cross the river. However, strong currents caused the floating bridge to be destroyed, and by the time it was repaired it was too late to influence the outcome of the battle. The crossing was still a success, but Stenbock's efforts were overshadowed. The main army occupied Courland and overwintered at the castle of Würgen outside of Libau.