The Swedish army was commanded personally by Charles XII, assisted by Lieutenant-General Carl Gustav Rehnskiöld and General of the cavalry Otto Vellingk. During the Scanian War in 1675–1679 Vellingk already was a colonel and commanded a cavalry regiment, and Rehnskiöld rose from lieutenant to lieutenant-colonel. Both also had the experience of service in foreign armies: Vellingk served for 10 years in France, during which he rose to the rank of colonel, and Rehnskiöld participated in the Franco-Dutch War (1688—1697). From 1698 Vellingk was a governor in Ingermanland and at the beginning of the Great Northern War commanded a small corps, sent to help besieged Riga.