The place has been inhabited since the 5th century BC. In Roman times the settlements were called Gorsium and Herculia. In about the 5th century AD, Slavic tribes began moving into the region and this place was called Belehrad or Belegrad, being a center during the Great Moravian period. In the Middle Ages its Latin name was Alba Regalis/Alba Regia. The town was an important traffic junction between Lake Balaton and Lake Velencei, several trade routes led from here to the Balkans and Italy, and to Buda and Vienna. (Today, the town is a junction of no less than seven railroad lines.)
The Hungarian town was founded in 972 by High Prince Géza on four islands in the moors of the streams Gaja and Sárvíz. He also had a small stone castle built. Székesfehérvár was first mentioned in a document by the Bishopric of Veszprém, 1009, as Alba Civitas.
St. Stephen granted town rights to the settlement, surrounded the town with a plank wall, had a provosty and a school built and under his rule the construction of the basilica began (it was built between 1003 and 1038). The settlement had about 3500 inhabitants at this time and was the royal seat for hundreds of years. 43 kings were crowned in Székesfehérvár (the last one in 1526) and 15 kings were buried here (the last one in 1540).
In the 12th century the town prospered, churches, monasteries and houses were built. It was an important station on the pilgrim road to the Holy Land. Andrew II issued the Golden Bull here in 1222. The Bull included the rights of nobles and the duties of the king, and the Constitution of Hungary was based on it until 1848. It is often compared to England's Magna Charta.
During the Mongol Invasion of Hungary (1241–1242) the invaders could not get close to the castle: Kadan ruled Mongol warriors could not get through the surrounding marshes because of flooding caused by melting snow. In the 13th–15th centuries the town prospered, several palaces were built. In the 14th century Székesfehérvár was surrounded by city walls.
The Ottomans occupied the city after a long siege in 1543 and only after a sally ended in most of the defenders including the commander, György Varkoch, being locked out by wealthy citizens fearing they might incur the wrath of the Ottomans by a lengthy siege. They discovered after surrendering, however, that the Ottomans were not without a sense for chivalry and those responsible for shutting the defenders out were put to death.
The city remained under Ottoman occupation for 145 years, until 1688, except for a short period in 1601 when it was re-occupied by an army led by Lawrence of Brindisi. The Ottomans destroyed most of the city, they demolished the cathedral and the royal palace, and they pillaged the graves of kings in the cathedral. They named the city Belgrade ("white city", from Serbian Beograd) and built mosques. In the 16th–17th centuries it looked like a Muslim city. Most of the original population fled. It was a sanjak centre in Budin Province as "İstolni Belgrad" during Ottoman rule.
The city began to prosper again only in the 18th century. It had a mixed population, Hungarians, Serbs, Germans and Moravians.
In 1702 Albert of Austria[disambiguation needed ] was ordered to blow up the cathedral of Nagyboldogasszony, therefore destroying the largest cathedral in Hungary at that time, and the coronation temple. According to the Doctrine of the Holy Crown, all kings of Hungary are obliged to be crowned in this cathedral, and to take part in coronation ceremony on the surroundings of the cathedral. The coronations after this time were done in Pozsony/Bratislava.
In 1703 Székesfehérvár regained the status of a free royal town. In the middle of the century several new buildings were erected (Franciscan church and monastery, Jesuit churches, public buildings, Baroque palaces). Maria Theresa made the city an episcopal seat in 1777.
By the early 19th century the German population was assimilated. On March 15, 1848 the citizens joined the revolution. After the revolution and war for independence Székesfehérvár lost its importance and became a mainly agricultural city. New prosperity arrived between the two world wars, when several new factories were opened.
After World War II the city was subject to the industrialization like many other cities and towns in the country. The most important factories were the Ikarus bus factory, the Videoton radio and TV factory and the Könnyűfémmű (colloquially Köfém) aluminium processing plant, since acquired by Alcoa. By the 1970s Székesfehérvár had swelled to more than 100,000 inhabitants (in 1945 it had only about 35,000.) Several housing estates were built, but the city centre was able to preserve its Baroque atmosphere. The most important Baroque buildings are the cathedral, the episcopal palace and the city hall.
In the past few decades archaeologists excavated medieval ruins (that of the Romanesque basilica and the mausoleum of St. Stephen of Hungary) that can be visited now.
At the end of the Socialist regime, all important factories were on the verge of collapsing (some eventually folded) and thousands of people lost their jobs. However, the city profited from losing the old and inefficient companies as abundance of skilled labour coupled with excellent traffic connections and existing infrastructure attracted numerous foreign firms seeking to invest in Hungary and Székesfehérvár became one of the prime destinations for multinational companies setting up shop in Hungary (Ford and IBM are some of them), turning the city into a success story of Hungary's transition into a market economy. A few years later Denso, Alcoa, Philips, and Sanmina-SCI Corporation also settled down in the city.