As an officer (rotmistrz) he fought in the Polish–Russian War of 1792 and later, as a colonel, in the Kościuszko Uprising. Tadeusz Kościuszko sent him to revolutionary France with the goal of obtaining help from the Committee of Public Safety, his requests for a French expeditionary corps were however futile. Under Napoleon, he would become (in 1797) a general in the Polish Legions, where he would be taken captive at the Siege of Mantua (1799). As a protest for the French-Austrian peace, he returned to partitioned Poland, but in 1809, with the France again at war with Austria, he would join the pro-French Polish forces and became a general in the Duchy of Warsaw, where he also became a deputy minister of war. He remained in the Duchy during Napoleon's invasion of Russia; in its aftermath, in the Congress Poland, he was a Minister of War and a member of its senate.