The Bulgar khanate was one of the great regional powers of the ninth century alongside the Roman and Frankish empires. The map below shows the Carpathian Basin and the northern Balkans in 837.

The Bulgar khanate held the eastern half of the Carpathian Basin while the Frankish empire had suzerainty over the western half. In 822, some Slavic tribes along the middle Danube switched allegiance from the Bulgar khan to the Frankish emperor, which brought up the question of just where the exact border between their two realms lay.

The two sides tried to reach an agreement, but when negotiations failed, they turned to blows. The Bulgars and Franks fought over several campaign seasons from 827 to 829 until a treaty was reached: the Bulgar khanate was to have the lands east of the Tisza, while the Frankish empire was to have those to west of the Danube, with the plains between those two rivers acting as a buffer zone.

During the course of the conflict, in 828, the Frankish emperor Ludwig abolished the tributary Avar khaganate established by his father Charlemagne and created the March of Pannonia in its stead. This realm ran from the Alps to the Danube and was officially part of the duchy of Bavaria. With this change, the Frankish empire extended its reach eastwards, while the Avars lost the last remnant of their state.

Nearly a decade later, another territorial change took place as the Bulgars came into conflict with the Romans. A previous treaty stipulated that the Romans had to hand over the city of Philippopolis to the Bulgars, but when the time came to do so in 836, they refused. War followed, and the Bulgars soon captured the disputed city.

A treaty concluded the following year in 837 officially handed them Philippopolis and its environs. The southern border of the Bulgar khanate thus came to follow the Maritsa River.

However, during the course of the war, the Bulgars also lost some land. The khan’s forces had previously captured the city of Adrianopolis and displaced all of its inhabitants north of the Danube to protect his eastern frontier. But while the Bulgar army had been preoccupied near Philippopolis, these exiled Romans rebelled, fought their way to the Danube, and met up with an imperial fleet which took them to Constantinople.

Their departure left a void on the khanate’s eastern frontier, and the Magyars who lived to the east took advantage of the vacuum. After 837, they migrated westwards from the Dniester to the Danube. Their communities thus came to directly border the Carpathian Mountains.