Today's Zagreb has grown out of two medieval settlements that for centuries developed on neighbouring hills. The first written mention of the city dates from 1094, when a Diocese was founded on Kaptol, while in 1242, neighbouring Gradec was proclaimed a free and royal city. Both the settlements were surrounded by high walls and towers, remains of which are still preserved.
During the Turkish onslaughts on Europe, between the 14th and 18th centuries, Zagreb was an important border fortress. The Baroque reconstruction of the city in the 17th and 18th centuries changed the appearance of the city. The old wooden houses were demolished, opulent palaces, monasteries and churches were built. The many trade fairs, the revenues from landed estates and the offerings of the many craft workshops greatly contributed to the wealth of the city. Affluent aristocratic families, royal officials, church dignitaries and rich traders from the whole of Europe moved into the city. Schools and hospitals were opened, and the manners of European capitals were adopted. The city outgrew its medieval borders and spread to the lowlands. The first parks and country houses were built. Zagreb confirmed its position as the administrative, cultural and economic centre of Croatia.
When Kaptol, Gradec and the surrounding settlements were administratively combined into the integrated city of Zagreb in 1850, the development accelerated still more. The disastrous earthquake of 1880 sparked off the reconstruction and modernization of many shabby neighbourhoods and buildings. Prestigious public buildings were erected, parks and fountains were made, and transportation and other infrastructures were organized.