In 1658 he took part in the Russo-Polish War, in which he and Nicholas Judyckim suffered a crushing defeat at Miadel on 8 February 1659. In 1667 he became hetman of Lithuania. After John II Casimir's abdication in 1668 he supported tsarevich Feodor (the future Feodor III of Russia) as candidate to be king of Poland.