He started his military career under king John I of Poland. He took part in successful campaigns against the Tatars and Grand Duchy of Moscow. For his victory near Ochakiv against the forces of Mehmet Girey he was awarded with the title of Grand Hetman of Lithuania. He was the first person to receive this title. However, during a war with Muscovy he was defeated in the Battle of Vedrosha (1500) and held captive for three years. In 1503 he managed to escape and joined king Sigismund I the Old, who allowed him to resume his post as a Hetman. As one of the main military leaders (alongside Grand Hetmans of the Crown Mikołaj Firlej and Mikołaj Kamieniecki) of the alliance he continued to wage war against the Grand Duchy of Moscow and in 1512 achieved a great victory against the Tatars in the Battle of Wiśniowiec.