and 445. The city was destroyed by an earthquake in 456. Savaria/Szombathely in the Middle Ages The city remained inhabited throughout the Middle Ages. Its city walls were restored, and new buildings were constructed using the stones from the remains of Roman buildings. Much of the Latin population moved away, mostly to Italy, while new settlers, mostly Goths and Longobards, arrived. In the 6th–8th centuries, the city was inhabited by Pannonian Avars and Slavic tribes. In 795, the Franks defeated these peoples and occupied the city. Charlemagne visited the city where St. Martin was born. King Arnulf of the Franks gave the city to the archbishop of Salzburg in 875. It is likely that the castle was built around this time, using the stones from the Roman baths. Around 900, they were succeeded by Hungarians, who became the dominant population. In 1009, Stephen I gave the city to the newly founded Diocese of Győr. The city suffered during the war between King Sámuel Aba and Holy Roman Emperor Henry III, between 1042 and 1044. Szombathely was destroyed during the Mongol invasion of Hungary in 1241–1242 but was rebuilt shortly after. It was granted Free royal town status in 1407. In 1578, it became the capital of Vas comitatus. The city prospered. In 1605 it was occupied by the armies of István Bocskai. Szombathely in the 16th to 19th centuries During the Ottoman occupation of Hungary, the Ottomans invaded the area twice, first in 1664, when they were defeated at the nearby town of Szentgotthárd. Nearly twenty years later, they invaded again in 1683, during the Battle of Vienna. The city walls protected Szombathely both times. A peaceful period followed the retreat of the Turks until Prince Rákóczi's rebellion against the Habsburgs in the early 18th century. During the rebellion, the city residents supported the prince. The city was occupied by Habsburg armies in 1704, freed in November 1705, then occupied alternately by the two armies over the next years. In June 1710, more than 2,000 people died in a plague, and on May 3, 1716, the city was destroyed by a fire. After such losses throughout the region, the Habsburg Crown recruited Germans to resettle the depopulated areas, particularly along the Danube River. They were valued for their farming abilities. The Crown allowed them to keep their language and religion. As a result, the city had a German majority for