 Upon his return to Poland, he co-authored the military reforms of 1776–1779.At the same time until May 1792 he was the commanding officer of the Polish 5th Rifle Regiment (), after which he was the creator and the first commander of the Polish 15th Regiment of Foot.One of the commanders of the garrison of Warsaw during the Warsaw Uprising (1794), he joined the Kościuszko's Uprising soon afterwards.