Kraków is one of the oldest cities in Poland, with evidence showing settlements there since 20,000 BC. Legend has it that it was built on the cave of a dragon whom the mythical King Krak had slain. However, the first official mention of the name was in 966 by a Jewish merchant from Spain, who described it as an important centre of trade in Slavonic Europe.
Through trade with the various rulers of Europe, it grew from a small settlement in 1000AD to a large wealthy city, belonging to the Vistulans. However, through the 9th and 10th centuries, it fell under the influence of the Great Moravians, then the Bohemians, before being captured by the Piast Dynasty of Poland. In 1038, Kazimierz the Restorer made Kraków the capital of Poland.
In 1241, the city was almost entirely destroyed by Tatars. It was rebuilt to a design that remains largely unchanged to the present day. However, after more successful attacks by the Mongols in the late 13th century, Kazimierz the Great set about defending the city. Walls, fortifications, and the original Wawel Castle were added. The University was also established. King Kazimierz established the district of Kazimierz for Jews to live in free from persecution. This area remained mainly Jewish for centuries until the Nazi occupation.
The 16th century was Kraków's golden age. Under the influence of the joint Polish-Lithuanian Jagiellonian dynasty, Kraków became a centre of science and the arts. In 1569, Poland was officially united with Lithuania and as a result government activity started to move to Warsaw. King Zygmunt III officially moved the capital in 1609.
However, the 17th century was a return to troubled times for Kraków and Poland. After being invaded by Russians, Prussians, Austrians, Transylvanians, Swedes, and the French, it went through a phase of various forms of political control. These included being part of the Duchy of Warsaw, established by Napoleon, and becoming an "independent city". However, it mostly fell under the sphere of influence of the Austrian Habsburg Empire, in the province of Galicia.
In the First World War, Józef Piłsudski set out to liberate Poland and the Treaty of Versailles (1919) established an independent sovereign Polish state for the first time in more than 100 years. This lasted until the Second World War, when Germany and the USSR partitioned the country, with German forces entering Kraków in September 1939. Many academics were killed and historic relics and monuments were destroyed or looted. Concentration camps were established near Kraków, including Plaszow and Auschwitz. After German withdrawal, the city escaped complete destruction and many buildings were saved.
In the Communist period, a large steel works was established in the suburb of Nowa Huta. This was seen as an attempt to lessen the influence of the anti-Communist intelligentsia and religious communities in Kraków. In 1978, UNESCO placed Kraków on the World Heritage Sites list. In the same year, the Archbishop of Kraków, Karol Wojtyła, was made Pope John Paul II.
The Communist Government collapsed in 1989 and Kraków has undergone another period of regeneration, with historic buildings being restored.