In 1760–1775, the city and the partly destroyed castle belonged to the Bishop of Vilnius Ignatius of Masala, and then by a decision of the diet (sejm) passed into the possession of the Polish-Lithuanian Commonwealth.
