The Avars were Turkic steppe nomads from the western arm of the steppes which stretched from the middle Danube river to the Ural river where it empties into the Caspian Sea.
The Byzantines, having successfully resisted the Huns in the 5th century by sheltering behind the walls of Constantinople and other cities, sought to divide and conquer any further nomadic invasions from the steppe.
The first time the Byzantines encountered the Turks was during the reign of the emperor Justinian I (527-565) when Avar envoys arrived at the court at Constantinople, seeking to enter into an alliance with the Byzantine emperors. Meanwhile the Gök Turks were also negotiating and claimed that the Avars were simply their wayward vassals.
The Byzantines wanted to use the Avars as allies but the Avars turned out not to be very good allies. To escape the control of the Gök Turks, they moved west and settled on the Hungarian plain, the same area that Attila had controlled. Having escaped the power of the western Turkish khagans, they began to raid into the Byzantine Empire. In the late 6th century, they followed the river systems of the Balkans and ravaged many of the same cities once ravaged by the Huns.
Even so, the imperial government still wanted the Avars as allies. There is a well-known story that the emperor Maurice Tiberius (582–602) sent an elephant and a gold couch to the Avar khagan to try to convince him to ally with the Byzantines. The gift back-fired as it merely illustrated what further gifts they could acquire if they further pressured the Byzantines.
During the 6th and 7th centuries the Byzantines were constantly at war with the Sassanid shahs of Persia. This made it difficult to deal with nomadic invaders. In 590, the legitimate Sassanid emperor, Khosrow II, was overthrown by one of his generals, and civil war broke out in Persia. Maurice Tiberius lent Khosrow the Roman army, which put him back on the throne in 591. That bought the Byzantine Empire a brief respite from Persian wars, allowing Maurice to go after the Avars.
Maurice tried to make his army over-winter in eastern Russia but they rebelled and murdered him in 602 and put Phocas on the throne. Khosrow took advantage of this situation by invading the Byzantine Empire, between 602 and 626. The Avars saw their chance. They entered into an alliance with the Khosrow and, in 626, besieged Constantinople on the European side.
This alliance failed, largely because of the brilliant campaigns of the emperor Heraclius. While his capital was besieged, the emperor moved the imperial army by sea into Armenia and joined up with the Gök Turks. Together, they waged a war against the Sassanid Empire that ended in total Byzantine victory by 628.
With the Muslim Arab conquest of Persia in 639, the pressure on the Byzantines decreased for a while. The Avars continued to be alternately allies and raiders. The Avars had suffered a significant check when they failed to take Constantinople in 626. The result was that Avar power receded. In the course of the 7th and 8th centuries, the Avars refocused their attacks on western Europe.
But those attacks drew the Avars to the attention of the Franks, who had reunited western Europe, especially under the emperor Charlemagne (768–814). Charlemagne eventually captured the main settlement of the Avars and broke their power in 796.