sentences:  Prince Siemowit IV, Duke of Masovia granted the city rights charter in 1406 and in 1869, during Russia's occupation, the town lost its city rights until 1994.Prior to the Deluge the town was famous and had a strong castle, but it was destroyed during that war.Polish Crown Kanclerz Andrzej Zamoyski was born there and lived in the palace he built while working on his code of civil laws known as "Zbiór praw sądowych" During Zamojski's residency there, in 1767, Polish-Lithuanian Commonwealth king Stanisław August Poniatowski granted the renewal of the town charter under the Magdeburg rights.