Towards the end of the 6th century the Byzantine state was exposed to destructive raids by Slavs, who made their first appearance at this time, and Avars. Apart from the settlement of Slavic tribes in Macedonia during the 7th century in the wake of their penetration as far as southern Greece, these incursions caused the abandonment of towns and economic decline, common occurrences throughout the Empire in the first years of the Middle Byzantine period.
Basilica of Agios Demetrios,
late 7th - early 8th century
These unprecedented conditions accelerated prolonged internal conflicts that were brought to an end by the introduction of the military-cum-administrative institution of 'themata' (themes). Thus, territorial shrinkage (the setting up of the first Bulgarian state in 681, the Arab expansion in the second half of the 7th century, and the crisis brought on by the Iconoclast controversy) led eventually to a greater uniformity of language, dogma, and culture among the population of Byzantium.
The emergence of a new state under Charlemagne in 800 curtailed Byzantine influence in the old territories of the western Roman world. But in the 9th century the Empire was able to undertake the conversion to Christianity of neighbouring peoples and to exert a cultural influence over them, and so to draw them into both its sphere of political influence and its cultural community, the "Byzantine commonwealth".