During the Bar Confederation he fought on the side of the Confederates, under the command of Casimir Pulaski against the Russians. In 1771, however, he passed over to the king's side. However, he soon returned to the Confederates and fought in the Battle of Stołowicze. In 1772 he became a major general of the Lithuanian army.