In the first centuries of the early Middle Ages in Istria various barbarian tribes invaded. While the Avars and Lombards lasted shorter drops and they did not remain in Istria, but the Slavs spread throughout the peninsula and settled in many parts of its interior. According to the testimony of Pope Gregory I. 600 years from the early 7th century. Comes to the Avar-Slavic incursions and settling of Croats. The inland cities have been destroyed, while the coastal parts still resist the attacks. Croats by mid July. c. settled middle regions and gradually reach out and to limit cities in the south and west of the peninsula. This is confirmed by archaeological research and the efforts of Pope Ivana IV. (640th to 642nd) to redeem prisoners of Slavs in Istria and Dalmatia, and that before the Slavic danger relics Istrian and Dalmatian early Christian martyrs prone to Rome. Weakening of the Franconian state and its fragmentation, Istria fell first of the Italic Empire, in 952 part of the duchy of Bavaria, 976 duchy of Carinthia, and finally in the 11th century became an independent territory under the authority of the church, ie Patriarch of Aquileia (northern Italy) and partly under German feudal families.