The Avar Khaganate was established in Europe in 567 after the Avars had migrated into the Carpathian Basin from the east. The crushed the Gepids and allied with the Lombards to form a strong realm in the area. For long periods they alternated between conflict and truce with the Eastern Roman Empire and had close dealings with the Lombard kings. However, a series of Frankish campaigns in the 790s led by Charlemagne ended with the conquest of the Avar realm in 804, with the March of Pannonia being formed to replace the Avar tribal lands.