Scotland was divided into a series of kingdoms in the early Middle Ages, i.e. between the end of Roman authority in southern and central Britain from around 400 CE and the rise of the kingdom of Alba in 900 CE. Of these, the four most important to emerge were the Picts, the Scots of Dál Riata, the Britons of Alt Clut, and the Anglian kingdom of Bernicia. After the arrival of the Vikings in the late 8th century, Scandinavian rulers and colonies were established on the islands and along parts of the coasts. In the 9th century, the House of Alpin combined the lands of the Scots and Picts to form a single kingdom which constituted the basis of the kingdom of Scotland.
Scotland has an extensive coastline and vast areas of difficult terrain and poor agricultural land. In this period, more land became marginal due to climate change, resulting in relatively light human settlement, particularly in the interior and Highlands. Northern Britain lacked urban centres and settlements were based on farmsteads and around fortified positions such as brochs, with mixed-farming primarily based on self-sufficiency. In this period, changes in settlement and colonisation meant that the Pictish and Brythonic languages began to be subsumed by Gaelic, English, and, at the end of the period, by Old Norse. Life expectancy was relatively low, leading to a young population, with a ruling aristocracy, freemen, and relatively large numbers of slaves. Kingship was multi-layered, with different kings surrounded by their war bands that made up the most important elements of armed forces, and who engaged in both low-level raiding and occasional longer-range, major campaigns.