The Roman Empire conquered the territory west of the Danube between 35 and 9 BC. From 9 BC to the end of the 4th century, Pannonia was part of the Roman Empire, located within part of later Hungary's territory. In this province lived the western tribes of the Huns and they left after losing the war against the Roman Army. Here, a 600 strong Roman legion created the settlement Aquincum in 41–54 CE. A civil city grew gradually in the neighborhood of the military settlement and in 106 CE Aquincum became the focal point of the commercial life of this area and the capital city of the Pannonian Inferior region. This area now corresponds to the Buda district of Budapest. Later came the Huns, who built a powerful empire. After the death of Attila, his sons divided his empire and the western tribes led by the oldest one, Buda made a new empire called Avar Khaganate in the Carpathian Basin.
In the 9th century, the Francs led by Charlemagne conquered Pannonia and the Khaganate fell apart. The khagan died in battle and the tribes started a civil war against each other. In 890 a tribe leader named Álmos unified them and conquered back the full basin east from the Danube.
The newly unified Hungarians led by Son of Álmos, Árpád started conquere back Pannonia in 895.