The first marches covering approximately the territory that would become Austria and Slovenia were the Avar March and the adjacent March of (the later March of Carinthia) in the south. Both were established in the late 8th century by Charlemagne upon the incorporation of the territory of the Agilolfing dukes of Bavaria against the invasions of the Avars. When the Avars disappeared in the 820s, they were replaced largely by West Slavs, who settled here within the state of Great Moravia. The March of Pannonia was set apart from the Duchy of Friuli in 828 and set up as a march against Moravia within the East Frankish of Bavaria. These march, already called , corresponded to a frontier along the Danube from the Traungau to and the river including the Vienna basin. By the 890s, the Pannonian march seems to have disappeared, along with the threat from Great Moravia, during the Hungarian invasions of Europe. Upon the defeat of Margrave Luitpold of Bavaria at the 907 Battle of Pressburg, all East Frankish lands beyond the Enns river were lost.