The Sejm moved to Warsaw in 1569 , and the death of the last ruler of the Jagiellonian dynasty , Zygmunt August , led to the creation of a Republic of Nobles and an elective monarchy that would serve it .
The Sejm had been in Gdansk in the 15th century .