This is the history of Bosnia and Herzegovina in the Middle Ages, between the ancient and Roman period and the Ottoman period.
The western Balkans had been reconquered from "barbarians" by Byzantine Emperor Justinian (r. 527–565). Sclaveni (Slavs) raided the western Balkans, including Bosnia, in the 6th century. The De Administrando Imperio (DAI; ca. 960) mentions Bosnia (Βοσωνα/Bosona) as a "small/little land" (or "small country",) part of Serbia, having been settled by Serbs along with Zahumlje and Travunija (both with territory in modern-day Bosnia and Herzegovina). This is the first mention of a distinct Bosnian region. Historians have established that the medieval Bosnian polity stretched from the Sarajevo field in the south to the Zenica field in the north, the eastern boundary being the Prača valley towards the Drina, the western along the Lepenica and Lašva valleys. In the Early Middle Ages, Fine, Jr. believes that what is today western Bosnia and Herzegovina was part of Croatia, while the rest was divided between Croatia and Serbia.
After the death of Serbian ruler Časlav (r. ca. 927–960), the Bosnian polity seems to have broken off the Serbian state and became politically independent. Bulgaria briefly subjugated Bosnia at the turn of the 10th century, after which it became part of the Byzantine Empire. In the 11th century, Zahumlje and Travunija were part of the Serbian state of Duklja.