Kingdom of Galicia–Volhynia
According to mainstream Ukrainian historiography, the western Ukrainian nobility developed out of a mixture of three groups of people: poor Rus boyars (East Slavic aristocrats from the medieval era), descendants of princely retainers or druzhina (free soldiers in the service of the Rus' princes), and peasants who had been free during the times of the Kingdom of Galicia–Volhynia. During the 12th and 13th centuries, fortified villages were built by Kievan Rus and Galician princes in order to defend the local lucrative salt trade and the borders with Poland and Hungary. These villages were located southwest of Lviv and Przemyśl in areas such as those surrounding Sambir, that in modern times have been the heartland for Ukrainian noble settlement. These villages were populated and defended by poor or minor boyars and druzhina. After the Kingdom of Galicia-Volhynia was absorbed by Poland in the fourteenth century, the noble status of these poor boyars and druzhina was confirmed in exchange for military service to the Polish crown; those poor boyars who failed to confirm their noble status were reduced to the level of serfs or, more frequently, town servants and assimilated into those social groups. The Ukrainian nobility's development thus involved a process of poor Rus boyars and druzhina changing their allegiance from the defunct East Slavic Kingdom of Galicia-Volhynia and its princes to that of the Polish Commonwealth, and becoming legally integrated into the Polish system as nobles.