 Boruth's successors had to accept the overlordship of Bavaria and the semifeudal Frankish kingdom, ruled by Charlemagne from 771 to 814.Charlemagne also put an end to the invasions undertaken by the Avars, who had regained eastern parts of Carantania between 745 and 795.In 828, Carantania finally became a margraviate of the Carolingian Empire.