During the Early Medieval period, the Carpathian Basin witnessed significant demographic shifts, notably under Avar dominance for approximately 250 years, followed by the settlement of early Hungarians in the region during the late 9th century CE. This study presents the genetic analysis of 296 ancient samples, including 103 shotgun-sequenced genomes, from present-day Western Hungary. Utilising identity-by-descent (IBD) segment sharing networks, this research provides detailed insights into the population structure and dynamics of the region, spanning the 5th to the 11th centuries CE, with certain microregional foci. Our findings highlight extensive homogenisation and reorganisation processes, discontinuities between Hun, Avar, and Conquest period immigrant groups, alongside the spread and integration of ancestry related to the Hungarian conquerors. This research is among the pioneering efforts to apply IBD analysis to ancient DNA, offering a nuanced understanding of the population dynamics between the 8th and 11th centuries CE in the Carpathian Basin.TeaserGenetic formation of mediaeval Hungary, discontinuity between immigrant groups in the first millennium CE