The town was granted municipal rights at some time after the Battle of Pabaiskas in 1435,[4] and written sources dating from 1486 referred to it as a city. King Sigismund the Old confirmed these rights. During the times of the Polish–Lithuanian Commonwealth, the city had been the center of powiat in the Vilnius Voivodeship.