From the 570s the Avars dominated the large area stretching from the Eastern Carpathians to the Eastern Alps in Central Europe. The localSlavic tribes were obliged to pay tribute to their overlords, but they began to resist in the early 7th century. First those who inhabited the region of today's Vienna threw off the yoke of the Avars in 623-624. They were led by a Frankish merchant named Samo whose reign would last for at least 35 years. However, when he died some time between 658 and 669, his principality collapsed without trace. Another century and a half passed before the Avars were finally defeated between 792 and 796 by Charlemagne, ruler of the Frankish Empire. In short time a series of Slavic principalities emerged in the regions on the Middle Danube. Among these polities, the Moravian principality showed up for the first time in 822 when the Moravians, according to the Royal Frankish Annals, brought tribute to Charlemagne's son, Emperor Louis the Pious.
Reign
Mojmir I arose in Moravia in the 820s. Whether he was the first ruler to unite the local Slavic tribes into a larger political unit or merely came into prominence as a result of the rapidly changing political situation, is uncertain. All the same, he had "predecessors", at least according to a letter written around 900 by Bavarian bishops to the pope. The idea that Mojmir I was baptized between 818 and 824 is based on indirect evidence, namely on the dating of a Christian church in Mikulčice to the first quarter of the 9th century. Although this idea is still a matter of scholarly debate, the History of the Bishops of Passau recorded a mass baptism of the Moravians in 831 by Bishop Reginhar of Passau. Even so, the pagansanctuary in Mikulčice continued in uninterrupted use until the middle of the 9th century. The frontiers of the Moravian state under Mojmir I are not precisely known. It is, however, certain that the Moravians were expanding in the 830s. By the time the document known as the Catalogue of Fortresses and Regions to the North of the Danube was compiled sometime between 844 and 862, the Moravians already held eleven fortresses in the region. Similarly, the Conversion of the Bavarians and the Carantanians, an historical work written in 870, relates that around 833 a local Slavic ruler, Pribina, was "driven across the Danube by Mojmir, duke of the Moravians". Pribina was either the head of another Slavic principality or one of Mojmir I's rebellious subordinates. Modern historians, although not unanimously, identify Pribina's lands "in Nitrava ultra Danubium" with modern Nitra.
Last years
Mojmir I used the civil war within the Carolingian Empire as an opportunity to plot a rebellion and try to throw off the yoke of Frankish overlordship in the 840s. Thus his emerging power became a serious threat to Louis II the German, ruler of the East Frankish kingdom. The Franks invaded Moravia in mid-August 846. They encountered little resistance and deprived Mojmir I of his throne. He seems to have fled or been killed during the invasion. His relative, Rastislav, was set up as the new client ruler of Moravia.