Royal elections in Poland (Polish: wolna elekcja, lit. free election) were the elections of individual kings, rather than dynasties, to the Polish throne. Based on traditions dating to the very beginning of the Polish statehood, strengthened during the Piast and Jagiellon dynasties, they reached their final form in the Polish–Lithuanian Commonwealth period between 1572 and 1791. The "free election" was abolished by the Constitution of 3 May 1791, which established a constitutional-parliamentary monarchy. Evolution The tradition of electing the country's ruler, which occurred either when there was no clear heir to the throne, or to confirm the heir's appointment, dates to the very beginning of Polish statehood. Legends survive of the 9th-century election of the legendary founder of the first Polish royal family, Piast the Wheelwright of the Piast dynasty, and similar voting of his son, Siemowit (that would place a Polish ruler's vote a century before the earliest Icelandic ones by the Althing). Still, sources for that time are very sparse, and it is hard to estimate whether those elections were more than a formality. The election privilege, exercised during the gatherings known as wiec, was usually limited to the most powerful nobles (magnates) or officials, and was heavily influenced by local traditions and strength of the ruler. Traditions diverged in different regions of Poland during the period of fragmentation of Poland. In the Duchy of Masovia, the hereditary principle dominated, but in the Seniorate Province, elections became increasingly important. In the other provinces both elements mixed together. By the 12th or 13th century, the wiec institution limited participation to high-ranking nobles and officials. The nationwide wiec gatherings of officials in 1306 and 1310 can be seen as a precursor of the general sejm (Polish parliament). The elections reinforced the empowerment of the electorate (the nobility), as the contender to the throne would increasingly consider issuing promises that he undertook to fulfil in the event of a successful election. Wenceslaus II of Bohemia made the first of such undertakings (the Litomyšl Privilege) in 1291. Nonetheless, for most of the Piast dynasty, electors customarily endorsed rulers from that dynasty, in accordance with hereditary descent. The Piast dynasty came to an end with the death without an heir of the last of the Polish Piasts of the main line, Casimir III the Great, in 1370. In a milestone for the process of the free elections, Casimir's nephew, Louis I of Hungary,