 An alliance between the Magyars and the Bulgarians in the late 830s was the first historical event that was recorded with certainty in connection with the Magyars . According to the Byzantine Emperor Constantine VII Porphyrogenitus , the Magyars lived in Levedia in the vicinity of the Khazar Khaganate in the early 9th century and supported the Khazars in their wars " for three years " . The Magyars were organized into tribes , each headed by their own " voivodes " , or military leaders . After a Pecheneg invasion against Levedia , a group of Magyars crossed the Caucasus Mountains and settled in the lands south of the mountains , but the majority of the people fled to the steppes north of the Black Sea . From their new homeland , which was known as Etelköz , the Magyars controlled the lands between the Lower Danube and the Don River in the 870s . The confederation of their seven tribes was led by two supreme chiefs , the kende and the gyula . The Kabars – a group of rebellious subjects of the Khazars – joined the Magyars in Etelköz . The Magyars regularly invaded the neighboring Slavic tribes , forcing them to pay a tribute and seizing prisoners to be sold to the Byzantines . Taking advantage of the wars between Bulgaria , East Francia , and Moravia , they invaded Central Europe at least four times between 861 and 894 . A new Pecheneg invasion compelled the Magyars to leave Etelköz , cross the Carpathian Mountains , and settle in the Carpathian Basin around 895 . 
