In 1799 he commanded the first division of the expedition to Holland under the command of general Johann Hermann von Fersen. From 1802 he was the military governor of Smolensk. He then fought in the 1807 war against Napoleon, being seriously wounded at Friedland.
1812
During the Patriotic War of 1812 he served as Military Governor of Riga in place of Dimitri Lobanov-Rostovsky and was forced to set fire to Riga's suburbs as soon as the enemy captured their outermost edge. After unsuccessful attempts to stop the Prussians at a distance from the city and unsuccessfully fighting to save Iecava, he ordered the burning of the suburbs but because of a strong wind the fire got out of control and thousands of city residents were left homeless.