The town's territory has been inhabited since prehistory. In the period of the Great Moravian one of the largest Great Moravian settlements lay on the opposite headland. In the 11th century Prince Břetislav built a castle on the rocky headland above the River Dyje. Several separate villages were situated in the settlement around the castle; these were later united into a town. That town was promoted to a royal town by the Czech King Přemysl Otakar I in around 1226. The 14th century brought a great development to the town. Znojmo already had streets made of cobblestones, a water pipe and two hospitals, which was very rare for any Czech town of those times. Znojmo was also affected by the Napoleonic Wars - for the first time in 1805 when the Russians and French went through before the Battle of Austerlitz, and another time was in 1809 when the Austrians and French fought in a battle near Znojmo. The 19th century was characterised in Znojmo by the development of mainly ceramic industry, food industry and especially of canning industry. Due to convenient climatic conditions and its geographical situation, growing of agricultural plants, especially of vines, which started to be grown already in the Great Moravian period, has been very successful in this location. Wine-making as well as fruit-farming were also popular. Znojmo has also become famous for its gherkins, the growing of which started in the region in the 16th century. In 1971 the historic centre of the city, due to its numerous protected sights, was declared an urban conservation area.