After returning to Poland, Sobieski and his brother came to Zamość, which at the time was being besieged by Cossacks. In 1648, 1649 and 1650 Sobieski was elected a member of the parliament ("sejm walny") of the Polish–Lithuanian Commonwealth. In 1649 he was among the electors who voted for John II Casimir as King of Poland. Then, as a head of a "chorągiew husarska" (military unit formed by Hussars) of 100 horse, the young starosta joined the army of Jeremi Wiśniowiecki.