From the beginning of the 17th century, Kraków gradually began to loose its role as the leading city in Poland. Causes for this were many and cumulative: the royal court's move to Warsaw, economic depression connected with the gradual decline of trade and production, restrictions on burghers’ rights imposed by the nobility and, lastly, a reduction of municipal property since the nobility and clergy who lived in the city did not share in its maintenance.
In the second half of the 17th century, Poland experienced a wave of wars, epidemics, and natural disasters which greatly contributed to the final decline of the city. It also suffered from occupation during the „Swedish Deluge” in the years 1655-1657 and four times in 1702, 1704, 1705 and 1709 during the Northern Wars. In the years 1657-1659 an Austrian garrison stationed in Kraków and from time to time troops from Saxony and Russia were billeted in the city. Foreign armies would loot and levy huge sums on Kraków as contribution to the fighting. Military incursions and fires led to the destruction of many buildings, which in turn resulted in the loss of city income from taxes. Furthermore, even in times of relative peace, Kraków carried the burden of maintaining the garrison stationed here, as well as having to raise taxes for the army.
Epidemics in the years 1651/52, 1677/80, 1707-10 decimated the population and a disastrous flood in 1652 caused great devastation resulting in famine and the abandonment of city buildings.
The authorities of Kraków would apply to the county rulers for financial aid and help to overcome these disasters but despite their generosity and concern the situation of dilapidation did not improve.
Kraków suffered other severe loses due to the Russian siege during the Confederation of Bar in 1768 and following the capture of the city a three-year occupation.
As a result of the first partition of Poland in 1772 and the subsequent Austrian occupation, Kraków became a border city and was cut off from the salt mines in Wieliczka, which had been the source of a considerable income.
During the reign of the last Polish king, Stanislaus Augustus (Stanisław August) Poniatowski (1732-1798), there were efforts to reform the state which had direct effects on cities and towns. The aim of Good Order Commissions, working in the years 1765-1788, were to prevent the decline of the cities and to heal their economy.
From 16 to 29 June 1787 the inhabitants of Kraków received their last royal visit. The visit of Stanislaus Augustus Poniatowski aroused great hope in the capital and a mission was sent to the monarch with a request for help in saving the city. Unfortunately, the scope of the mission was limited and the requests made quite anachronistic and did not go in any way towards introducing any far-sighted reforms.
However, the Great Sejm (national assembly), started in 1788, raised hope in the cities for the improvement of their situation.
Initially, the City Council of Kraków did not support the common initiatives of the royal cities, which aimed for the introduction of modern laws and privileges, but eventually the delegates from Kraków took part in the commission working on reform projects. Law on cities, passed on 18 April 1791, was later included in the 3rd May Constitution of 1791.
This law unified the rights of all royal cities, granting the burghers many rights which had been reserved only for the nobility. The Kraków settlement created one city, joining the areas of Kraków, Kazimierz and Kleparz, together with their suburbs and other areas which had been excluded from the city jurisdiction. Kraków was nominated the seat of the court of appeals and was divided into four districts. A symbolic gesture of class equality in Kraków was the process of inscribing representatives of the nobility into the books of citizenship (even if those books were abolished by the new parliamentary act). The City Council was replaced by the assembly of sixty councillors, who elected executive power – a board consisting of the president, vice-president and eight councillors. In a formal and legal sense, the passing of the Law on cities ended the period of being bound to the norms of Magdeburg Law.
In 1792, the Confederation of Targowica abolished all the decisions taken by the Great Sejm and restored the previous form of government. The municipal institutions from the times of the Great Sejm were restored for a short time during the Kościuszko Rising in the years 1794-1795.
Following the third partition of Poland in 1795, Kraków was annexed to Austria. It was the Austrian authorities who, in 1800, finally carried the unification of Kraków, Kazimierz and Kleparz into one city organism.