From the fifth century northern Britain was divided into a series of petty kingdoms. Of these the four most important to emerge were the Picts, the Gaels of Dál Riata, the Britons of Strathclyde and the Anglo-Saxon kingdom of Bernicia, later taken over by Northumbria. After the arrival of the Vikings in the late eighth century, Scandinavian rulers and colonies were established along parts of the coasts and in the islands.
In the ninth century the Scots and Picts combined under the House of Alpin to form a single Kingdom of Alba, with a Pictish base and dominated by Gaelic culture. After the reign of King David I in the twelfth century, the Scottish monarchs are best described as Scoto-Norman, preferring French culture to native Scottish culture. Alexander II and his son Alexander III, were able to regain the remainder of the western seaboard, cumulating the Treaty of Perth with Norway in 1266.
After being invaded and briefly occupied, Scotland re-established its independence from England under figures including William Wallace in the late thirteenth century and Robert Bruce in the fourteenth century.
In the fifteenth century under the Stewart Dynasty, despite a turbulent political history, the crown gained greater political control at the expense of independent lords and regained most of its lost territory to approximately the modern borders of the country. However, the Auld Alliance with France led to the heavy defeat of a Scottish army at the Battle of Flodden in 1513 and the death of the king James IV, which would be followed by a long minority and a period of political instability. Kingship was the major form of government, growing in sophistication in the late Middle Ages. The scale and nature of war also changed, with larger armies, naval forces and the development of artillery and fortifications.
The Church in Scotland always accepted papal authority (contrary to the implications of Celtic Christianity), introduced monasticism, and from the eleventh century embraced monastic reform, developing a flourishing religious culture that asserted its independence from English control.
Scotland grew from its base in the eastern Lowlands, to approximately its modern borders. The varied and dramatic geography of the land provided a protection against invasion, but limited central control. It also defined the largely pastoral economy, with the first burghs being created from the twelfth century. The population may have grown to a peak of a million before the arrival of the Black Death in 1350. In the early Middle Ages society was divided between a small aristocracy and larger numbers of freemen and slaves. Serfdom disappeared in the fourteenth century and there was a growth of new social groups.
The Pictish and Cumbric languages were replaced by Gaelic, Old English and later Norse, with Gaelic emerging as the major cultural language. From the eleventh century French was adopted in the court and in the late Middle Ages, Scots, derived from Old English, became dominant, with Gaelic largely confined to the Highlands. Christianity brought Latin, written culture and monasteries as centres of learning. From the twelfth century, educational opportunities widened and a growth of lay education cumulated in the Education Act 1496. Until in the fifteenth century, when Scotland gained three universities, Scots pursuing higher education had to travel to England or the continent, where some gained an international reputation. Literature survives in all the major languages present in the early Middle Ages, with Scots emerging as a major literary language from John Barbour's Brus (1375), developing a culture of poetry by court makars, and later major works of prose. Art from the early Middle Ages survives in carving, in metalwork, and elaborate illuminated books, which contributed to the development of the wider insular style. Much of the finest later work has not survived, but there are a few key examples, particularly of work commissioned in the Netherlands. Scotland had a musical tradition, with secular music composed and performed by bards and from the thirteenth century, church music increasingly influenced by continental and English forms.
In the centuries after the departure of the Romans from Britain, four major circles of influence emerged within the borders of what is now Scotland. In the east were the Picts, whose kingdoms eventually stretched from the river Forth to Shetland. The first identifiable king to have exerted a superior and wide-ranging authority, was Bridei mac Maelchon (r. c. 550-84), whose power was based in the Kingdom of Fidach and his base was at the fort of Craig Phadrig near modern Inverness. After his death leadership seems to have shifted to the Fortriu, whose lands were centred on Strathearn and Menteith and who raided along the eastern coast into modern England. Christian missionaries from Iona appear to have begun the conversion of the Picts to Christianity from 563.
In the west were the Gaelic (Goidelic)-speaking people of Dál Riata with their royal fortress at Dunadd in Argyll, with close links with the island of Ireland, from which they brought with them the name Scots. In 563 a mission from Ireland under St. Columba founded the monastery of Iona off the west coast of Scotland and probably began the conversion of the region to Christianity. The kingdom reached its height under Áedán mac Gabráin (r. 574-608), but its expansion was checked at the Battle of Degsastan in 603 by Æthelfrith of Northumbria.
In the south was the British (Brythonic) Kingdom of Strathclyde, descendants of the peoples of the Roman influenced kingdoms of "The Old North", often named Alt Clut, the Brythonic name for their capital at Dumbarton Rock. In 642, they defeated the men of Dál Riata, but the kingdom suffered a number of attacks from the Picts, and later their Northumbrian allies, between 744 and 756. After this, little is recorded until Alt Clut was burnt and probably destroyed in 780, although by whom and what in what circumstances is not known.
Finally, there were the English or "Angles", Germanic invaders who had overrun much of southern Britain and held the Kingdom of Bernicia, in the south-east. The first English king in the historical record is Ida, who is said to have obtained the throne and the kingdom about 547. Ida's grandson, Æthelfrith, united his kingdom with Deira to the south to form Northumbria around the year 604. There were changes of dynasty, and the kingdom was divided, but it was re-united under Æthelfrith's son Oswald (r. 634-42), who had converted to Christianity while in exile in Dál Riata and looked to Iona for missionaries to help convert his kingdom.
This situation was transformed in AD 793 when ferocious Viking raids began on monasteries like Iona and Lindisfarne, creating fear and confusion across the kingdoms of North Britain. Orkney, Shetland and the Western Isles eventually fell to the Norsemen. The King of Fortriu, Eógan mac Óengusa, and the King of Dál Riata Áed mac Boanta, were among the dead in a major defeat at the hands of the Vikings in 839. A mixture of Viking and Gaelic Irish settlement into south-west Scotland produced the Gall-Gaidel, the Norse Irish, from which the region gets the modern name Galloway. Sometime in the ninth century the beleaguered Kingdom of Dál Riata lost the Hebrides to the Vikings, when Ketil Flatnose is said to have founded the Kingdom of the Isles.
These threats may have speeded a long term process of gaelicisation of the Pictish kingdoms, which adopted Gaelic language and customs. There was also a merger of the Gaelic and Pictish crowns, although historians debate whether it was a Pictish takeover of Dál Riata, or the other way around. This culminated in the rise of Cínaed mac Ailpín (Kenneth MacAlpin) in the 840s, which brought to power the House of Alpin. In AD 867 the Vikings seized Northumbria, forming the Kingdom of York; three years later they stormed the Britons' fortress of Dumbarton and subsequently conquered much of England except for a reduced Kingdom of Wessex, leaving the new combined Pictish and Gaelic kingdom almost encircled. When he died as king of the combined kingdom in 900, Domnall II (Donald II) was the first man to be called rí Alban (i.e. King of Alba). The term Scotia would be increasingly be used to describe the kingdom between North of the Forth and Clyde and eventually the entire area controlled by its kings would be referred to as Scotland.
The long reign (900-942/3) of Causantín (Constantine II) is often regarded as the key to formation of the Kingdom of Alba. He was later credited with bringing Scottish Christianity into conformity with the Catholic Church. After fighting many battles, his defeat at Brunanburh was followed by his retirement as a Culdee monk at St. Andrews. The period between the accession of his successor Máel Coluim I (Malcolm I) and Máel Coluim mac Cináeda (Malcolm II) was marked by good relations with the Wessex rulers of England, intense internal dynastic disunity and relatively successful expansionary policies. In 945, Máel Coluim I annexed Strathclyde, where the kings of Alba had probably exercised some authority since the later ninth century, as part of an agreement with King Edmund of England. This event was offset by loss of control in Moray. The reign of King Donnchad I (Duncan I) from 1034 was marred by failed military adventures, and he was defeated and killed by Macbeth, the Mormaer of Moray, who became king in 1040. MacBeth ruled for 17 years before he was overthrown by Máel Coluim, the son of Donnchad, who some months later defeated Macbeth's step-son and successor Lulach to become king Máel Coluim III (Malcolm III).
It was Máel Coluim III, who acquired the nickname "Canmore" (Cenn Mór, "Great Chief"), which he passed to his successors and who did most to create the Dunkeld dynasty that ruled Scotland for the following two centuries. Particularly important was his second marriage to the Anglo-Hungarian princess Margaret. This marriage, and raids on northern England, prompted William the Conqueror to invade and Máel Coluim submitted to his authority, opening up Scotland to later claims of sovereignty by English kings. When Malcolm died in 1093, his brother Domnall III (Donald III) succeeded him. However, William II of England backed Máel Coluim's son by his first marriage, Donnchad, as a pretender to the throne and he seized power. His murder within a few months saw Domnall restored with one of Máel Coluim sons by his second marriage, Edmund, as his heir. The two ruled Scotland until two of Edmund's younger brothers returned from exile in England, again with English military backing. Victorious, Edgar, the oldest of the three, became king in 1097. Shortly afterwards Edgar and the King of Norway, Magnus Bare Legs concluded a treaty recognising Norwegian authority over the Western Isles. In practice Norse control of the Isles was loose, with local chiefs enjoying a high degree of independence. He was succeeded by his brother Alexander, who reigned 1107-24.
When Alexander died in 1124, the crown passed to Margaret's fourth son David I, who had spent most of his life as an English baron. His reign saw what has been characterised as a "Davidian Revolution", by which native institutions and personnel were replaced by English and French ones, underpinning the development of later Medieval Scotland. Members of the Anglo-Norman nobility took up places in the Scottish aristocracy and he introduced a system of feudal land tenure, which produced knight service, castles and an available body of heavily armed body of cavalry. He created an Anglo-Norman style of court, introduced the office of justicar to oversee justice, and local offices of sheriffs to administer localities. He established the first royal burghs in Scotland, granting rights to particular settlements, which led to the development of the first true Scottish towns and helped facilitate economic development as did the introduction of the first recorded Scottish coinage. He continued a process begun by his mother and brothers, of helping to establish foundations that brought the reformed monasticism based on that at Cluny. He also played a part in the organisation of diocese on lines closer to those in the rest of Western Europe.
These reforms were pursued under his successors and grandchildren Malcolm IV of Scotland and William I, with the crown now passing down the main line of descent through primogeniture, leading to the first of a series of minorities. The benefits of greater authority were reaped by William's son Alexander II and his son Alexander III, who pursued a policy of peace with England to expand their authority in the Highlands and Islands. By the reign of Alexander III, the Scots were in a position to annexe the remainder of the western seaboard, which they did following Haakon Haakonarson's ill-fated invasion and the stalemate of the Battle of Largs with the Treaty of Perth in 1266.
The death of King Alexander III in 1286, and then of his granddaughter and heir Margaret, Maid of Norway in 1290, left 14 rivals for succession. To prevent civil war the Scottish magnates asked Edward I of England to arbitrate, for which he extracted legal recognition that the realm of Scotland was held as a feudal dependency to the throne of England before choosing John Balliol, the man with the strongest claim, who became king in 1292.Robert Bruce, 5th Lord of Annandale, the next strongest claimant, accepted this outcome with reluctance. Over the next few years Edward I used the concessions he had gained to systematically undermine both the authority of King John and the independence of Scotland. In 1295 John, on the urgings of his chief councillors, entered into an alliance with France, known as the Auld Alliance. In 1296 Edward invaded Scotland, deposing King John. The following year William Wallace and Andrew de Moray raised forces to resist the occupation and under their joint leadership an English army was defeated at the Battle of Stirling Bridge. For a short time Wallace ruled Scotland in the name of John Balliol as guardian of the realm. Edward came north in person and defeated Wallace at the Battle of Falkirk. The English barons refuted the French-inspired papal claim to Scottish overlordship in the Barons' Letter, 1301, claiming it rather as long possessed by English kings. Wallace escaped but probably resigned as Guardian of Scotland. In 1305 he fell into the hands of the English, who executed him for treason despite the fact that he believed he owed no allegiance to England.
Rivals John Comyn and Robert the Bruce, grandson of the claimant, were appointed as joint guardians in his place. On 10 February 1306, Bruce participated in the murder of Comyn, at Greyfriars Kirk in Dumfries. Less than seven weeks later, on 25 March, Bruce was crowned as king. However, Edward's forces overran the country after defeating Bruce's small army at the Battle of Methven. Despite the excommunication of Bruce and his followers by Pope Clement V, his support slowly strengthened; and by 1314 with the help of leading nobles such as Sir James Douglas and Thomas Randolph only the castles at Bothwell and Stirling remained under English control. Edward I had died in 1307. His heir Edward II moved an army north to break the siege of Stirling Castle and reassert control. Robert defeated that army at the Battle of Bannockburn in 1314, securing de facto independence. In 1320 the Declaration of Arbroath, a remonstrance to the pope from the nobles of Scotland, helped convince Pope John XXII to overturn the earlier excommunication and nullify the various acts of submission by Scottish kings to English ones so that Scotland's sovereignty could be recognised by the major European dynasties. The declaration has also been seen as one of the most important documents in the development of a Scottish national identity.
In 1328, Edward III signed the Treaty of Northampton acknowledging Scottish independence under the rule of Robert the Bruce. However, four years after Robert's death in 1329, England once more invaded on the pretext of restoring Edward Balliol, son of John Balliol, to the Scottish throne, thus starting the Second War of Independence. Despite victories at Dupplin Moor and Halidon Hill, in the face of tough Scottish resistance led by Sir Andrew Murray, the son of Wallace's comrade in arms, successive attempts to secure Balliol on the throne failed. Edward III lost interest in the fate of his protege after the outbreak of the Hundred Years' War with France. In 1341 David II, King Robert's son and heir, was able to return from temporary exile in France. Balliol finally resigned his claim to the throne to Edward in 1356, before retiring to Yorkshire, where he died in 1364.
After David II's death, Robert II, the first of the Stewart kings, came to the throne in 1371. He was followed in 1390 by his ailing son John, who took the regnal name Robert III. During Robert III's reign (1390-1406), actual power rested largely in the hands of his brother, Robert Stewart, Duke of Albany. After the suspicious death (possibly on the orders of the Duke of Albany) of his elder son, David, Duke of Rothesay in 1402, Robert, fearful for the safety of his younger son, the future James I, sent him to France in 1406. However, the English captured him en route and he spent the next 18 years as a prisoner held for ransom. As a result, after the death of Robert III, regents ruled Scotland: first, the Duke of Albany; and later his son Murdoch.
When Scotland finally paid the ransom in 1424, James, aged 32, returned with his English bride determined to assert this authority. Several members of the Albany family were executed, and he succeeded in centralising control in the hands of the crown, but at the cost of increasingly unpopularity and he was assassinated in 1437. His son James II when he came of age in 1449, continued his father's policy of weakening the great noble families, most notably taking on the powerful Black Douglas family that had come to prominence at the time of Robert I. His attempt to take Roxburgh from the English in 1460 succeeded, but at the cost of his life as he was killed by an exploding artillery piece.
His young son came to the throne as James III, resulting in another minority, with Robert, Lord Boyd emerging as the most important figure. In 1468 James married Margaret of Denmark, receiving the Orkney and the Shetland Islands in payment of her dowry. In 1469 the King asserted his control, executing members of the Boyd family and his brothers, Alexander, Duke of Albany and John, Earl of Mar, resulting in Albany leading an English backed invasion and becoming effective ruler. The English retreated, having taken Berwick for the last time in 1482, and James was able to regain power. However, the King managed to alienate the barons, former supporters, his wife and his son James. He was defeated at the Battle of Sauchieburn and killed in 1488.
His successor James IV successfully ended the quasi-independent rule of the Lord of the Isles, bringing the Western Isles under effective Royal control for the first time. In 1503, he married Margaret Tudor, daughter of Henry VII of England, thus laying the foundation for the seventeenth century Union of the Crowns. However, in 1512 the Auld Alliance was renewed and under its terms, when the French were attacked by the English under Henry VIII the next year, James IV invaded England in support. The invasion was stopped decisively at the Battle of Flodden during which the King, many of his nobles, and a large number of ordinary troops were killed. Once again Scotland's government lay in the hands of regents in the name of the infant James V.
Kingship was the major form of political organisation in the Early Middle Ages, with competing minor kingdoms and fluid relationships of over and under kingdoms. The primary function of these kings was as war leaders, but there were also ritual elements to kingship, evident in ceremonies of coronation.The unification of the Scots and Picts from the tenth century that produced the Kingdom of Alba, retained some of these ritual aspects in the coronation at Scone. While the Scottish monarchy remained a largely itinerant institution, Scone remained one of its most important locations, with Royal castles at Stirling and Perth becoming significant in the later Middle Ages before Edinburgh developed as a capital in the second half of the fifteenth century. The Scottish crown grew in prestige throughout the era and adopted the conventional offices of Western European courts and later elements of their ritual and grandeur.
In the early period the kings of the Scots depended on the great lords of the mormaers (later earls) and Toísechs (later thanes), but from the reign of David I sheriffdoms were introduced, which allowed more direct control and gradually limited the power of the major lordships. While knowledge of early systems of law is limited, justice can be seen as developing from the twelfth century onwards with local sheriff, burgh, manorial and ecclesiastical courts and offices of the justicar to oversee administration. The Scots common law began to develop in this period and there were attempts to systematise and codify the law and the beginnings of an educated professional body of lawyers. In the Late Middle Ages major institutions of government, including the privy council and parliament developed. The council emerged as a full-time body in the fifteenth century, increasingly dominated by laymen and critical to the administration of justice. Parliament also emerged as a major legal institution, gaining an oversight of taxation and policy. By the end of the era it was sitting almost every year, partly because of the frequent minorities and regencies of the period, which may have prevented it from being sidelined by the monarchy.
In the Early Middle Ages, war on land was characterised by the use of small war-bands of household troops often engaging in raids and low level warfare. The arrival of the Vikings brought a new scale of naval warfare, with rapid movement based around the Viking longship. The birlinn, which developed from the longship, became a major factor in warfare in the Highlands and Islands. By the High Middle Ages, the kings of Scotland could command forces of tens of thousands of men for short periods as part of the "common army", mainly of poorly armoured spear and bowmen. After the introduction of feudalism to Scotland, these forces were augmented by small numbers of mounted and heavily armoured knights. Feudalism also introduced castles into the country, originally simple wooden motte-and-bailey constructions, but these were replaced in the thirteenth century with more formidable stone "enceinte" castles, with high encircling walls. In the thirteenth century the threat of Scandinavian naval power subsided and the kings of Scotland were able to use naval forces to help subdue the Highlands and Islands.
Scottish field armies rarely managed to stand up to the usually larger and more professional armies produced by England, but they were used to good effect by Robert I at Bannockburn in 1314 to secure Scottish independence. He also made use of naval power to support his forces and began to develop a royal Scottish naval force. Under the Stewart kings these forces were further augmented by specialist troops, particularly men-at-arms and archers, hired by bonds of manrent, similar to English indentures of the same period. New "livery and maintenance" castles were built to house these troops and castles began to be adapted to accommodate gunpowder weapons. The Stewarts also adopted major innovations in continental warfare, such as longer pikes  and the extensive use of artillery, and they built up a formidable navy. However, in the early fifteenth century one of the best armed and largest Scottish armies ever assembled still met with defeat at the hands of an English army at the Battle of Flodden in 1513, which saw the destruction of a large number of ordinary troops, a large section of the nobility and the king, James IV.
Christianity was probably introduced to what is now lowland Scotland from Roman soldiers stationed in the north of the province of Britannia. It is presumed to have survived among the Brythonic enclaves in the south of modern Scotland, but retreated as the pagan Anglo-Saxons advanced. Scotland was largely converted by Irish-Scots missions associated with figures such as St Columba from the fifth to the seventh centuries. These missions tended to found monastic institutions and collegiate churches that served large areas. Partly as a result of these factors, some scholars have identified a distinctive form of Celtic Christianity, in which abbots were more significant than bishops, attitudes to clerical celibacy were more relaxed and there was some significant differences in practice with Roman Christianity, particularly the form of tonsure and the method of calculating Easter, although most of these issues had been resolved by the mid-seventh century. After the reconversion of Scandinavian Scotland from the tenth century, Christianity under papal authority was the dominant religion of the kingdom.
In the Norman period the Scottish church underwent a series of reforms and transformations. With royal and lay patronage, a clearer parochial structure based around local churches was developed. Large numbers of new foundations, which followed continental forms of reformed monasticism, began to predominate and the Scottish church established its independence from England, developed a clearer diocesan structure, becoming a "special daughter of the see of Rome", but lacking leadership in the form of archbishops. In the Late Middle Ages the problems of schism in the Catholic Church allowed the Scottish Crown to gain greater influence over senior appointments and two archbishoprics had been established by the end of the fifteenth century. While some historians have discerned a decline of monasticism in the Late Middle Ages, the mendicant orders of friars grew, particularly in the expanding burghs, to meet the spiritual needs of the population. New saints and cults of devotion also proliferated. Despite problems over the number and quality of clergy after the Black Death in the fourteenth century, and some evidence of heresy in this period, the church in Scotland remained relatively stable before the Reformation in the sixteenth century.
Modern Scotland is half the size England and Wales in area, but with its many inlets, islands and inland lochs, it has roughly the same amount of coastline at 4,000 miles. Only a fifth of Scotland is less than 60 metres above sea level. Its east Atlantic position means that it has very heavy rainfall: today about 700 cm per year in the east and over 1,000 cm in the west. This encouraged the spread of blanket peat bog, the acidity of which, combined with high level of wind and salt spray, made most of the islands treeless. The existence of hills, mountains, quicksands and marshes made internal communication and conquest extremely difficult and may have contributed to the fragmented nature of political power.
The defining factor in the geography of Scotland is the distinction between the Highlands and Islands in the north and west and the Lowlands in the south and east. The highlands are further divided into the Northwest Highlands and the Grampian Mountains by the fault line of the Great Glen. The lowlands are divided into the fertile belt of the Central Lowlands and the higher terrain of the Southern Uplands, which included the Cheviot hills, over which the border with England came to run by the end of the period. Some of these were further divided by mountains, major rivers and marshes. The Central Lowland belt averages about 50 miles in width and, because it contains most of the good quality agricultural land and has easier communications, could support most of the urbanisation and elements of conventional Medieval government. However, the Southern Uplands, and particularly the Highlands were economically less productive and much more difficult to govern. This provided Scotland with a form of protection, as minor English incursions had to cross the difficult southern uplands and the two major attempts at conquest by the English, under Edward I and then Edward III, were unable to penetrate the highlands, from which area potential resistance could reconquer the Lowlands. However, it also made those areas problematic to govern for Scottish kings and much of the political history of the era after the wars of independence circulated around attempts to resolve problems of entrenched localism in these regions.
Until the thirteenth century the borders with England were very fluid, with Northumbria being annexed to Scotland by David I, but lost under his grandson and successor Malcolm IV in 1157. By the late thirteenth century when the Treaty of York (1237) and Treaty of Perth (1266) had fixed the boundaries with the Kingdom of the Scots with England and Norway respectively, its borders were close to the modern boundaries. The Isle of Man fell under English control in the fourteenth century, despite several attempts to restore Scottish authority. The English were able to annexe a large slice of the Lowlands under Edward III, but these losses were gradually regained, particularly while England was preoccupied with the Wars of the Roses (1455-85). The dowry of the Orkney and Shetland Islands in 1468 was the last great land acquisition for the kingdom. However, in 1482 Berwick, a border fortress and the largest port in Medieval Scotland, fell to the English once again, for what was to be the final change of hands.
Having between a fifth or sixth ( 15-20 % ) of the arable or good pastoral land and roughly the same amount of coastline as England and Wales, marginal pastoral agriculture and fishing were two of the most important aspects of the Medieval Scottish economy. With poor communications, in the Early Middle Ages most settlements needed to achieve a degree of self-sufficiency in agriculture. Most farms were based around a family unit and used an infield and outfield system. Arable farming grew in the High Middle Ages and agriculture entered a period of relative boom between the thirteenth century and late fifteenth century.
Unlike England, Scotland had no towns dating from Roman occupation. From the twelfth century there are records of burghs, chartered towns, which became major centres of crafts and trade. and there is evidence of 55 burghs by 1296. There are also Scottish coins, although English coinage probably remained more significant in trade and until the end of the period barter was probably the most common form of exchange. Nevertheless, craft and industry remained relatively undeveloped before the end of the Middle Ages and, although there were extensive trading networks based in Scotland, while the Scots exported largely raw materials, they imported increasing quantities of luxury goods, resulting in a bullion shortage and perhaps helping to create a financial crisis in the fifteenth century.
There are almost no written sources from which to re-construct the demography of early Medieval Scotland. Estimates have been made of a population of 10,000 inhabitants in Dál Riata and 80-100,000 for Pictland. It is likely that the 5th and 6th centuries saw higher mortality rates due to the appearance of bubonic plague, which may have reduced net population. The examination of burial sites for this period like that at Hallowhill, St Andrews indicate a life expectancy of only 26-29 years. The known conditions have been taken to suggest it was a high fertility, high mortality society, similar to many developing countries in the modern world, with a relatively young demographic profile, and perhaps early childbearing, and large numbers of children for women. This would have meant that there were a relatively small proportion of available workers to the number of mouths to feed. This have made it difficult to produce a surplus that would allow demographic growth and more complex societies to develop. From the formation of the Kingdom of Alba in the tenth century, to before the Black Death reached the country in 1349, estimates based on the amount of farmable land, suggest that population may have grown from half a million to a million. Although there is no reliable documentation on the impact of the plague, there are many anecdotal references to abandoned land in the following decades. If the pattern followed that in England, then the population may have fallen to as low as half a million by the end of the fifteenth century. Compared with the situation after the redistribution of population in the later clearances and the industrial revolution, these numbers would have been relatively evenly spread over the kingdom, with roughly half living north of the Tay. Perhaps ten per cent of the population lived in one of many burghs that grew up in the later Medieval period, mainly in the east and south. It has been suggested that they would have had a mean population of about 2,000, but many would be much smaller than 1,000 and the largest, Edinburgh, probably had a population of over 10,000 by the end of the era.
The organisation of society is obscure in the early part of the period, for which there are few documentary sources. Kinship probably provided the primary unit of organisation and society was divided between a small aristocracy, whose rationale was based around warfare, a wider group of freemen, who had the right to bear arms and were represented in law codes, above a relatively large body of slaves, who may have lived beside and become clients of their owners. By the thirteenth century there are sources that allow greater stratification in society to be seen, with layers including the king and a small elite of mormaers above lesser ranks of freemen and what was probably a large group of serfs, particularly in central Scotland. In this period the feudalism introduced under David I meant that baronial lordships began to overlay this system, the English terms earl and thane became widespread. Below the noble ranks were husbandmen with small farms and growing numbers of cottars and gresemen with more modest landholdings.
The combination of agnatic kinship and feudal obligations has been seen as creating the system of clans in the Highlands in this era. Scottish society adopted theories of the three estates to describe its society and English terminology to differentiate ranks. Serfdom disappeared from the records in the fourteenth century and new social groups of labourers, craftsmen and merchants, became important in the developing burghs. This led to increasing social tensions in urban society, but, in contrast to England and France, there was a lack of major unrest in Scottish rural society, where there was relatively little economic change.
Modern linguists divide Celtic languages into two major groups, the P-Celtic, from which the Brythonic languages: Welsh, Breton, Cornish and Cumbric derive, and the Q-Celtic, from which come the Goidelic languages: Irish, Manx and Gaelic. The Pictish language remains enigmatic, since the Picts had no written script of their own and all that survives are place names and some isolated inscriptions in Irish ogham script. Most modern linguists accept that, although the nature and unity of Pictish language is unclear, it belonged to the former group. Historical sources, as well as place name evidence, indicate the ways in which the Pictish language in the north and Cumbric languages in the south were overlaid and replaced by Gaelic, Old English and later Norse in this period. By the High Middle Ages the majority of people within Scotland spoke the Gaelic language, then simply called Scottish, or in Latin, lingua Scotica. The Kingdom of Alba was overwhelmingly an oral society dominated by Gaelic culture. Our fuller sources for Ireland of the same period suggest that there would have been filidh, who acted as poets, musicians and historians, often attached to the court of a lord or king, and passed on their knowledge and culture in Gaelic to the next generation.
In the Northern Isles the Norse language brought by Scandinavian occupiers and settlers evolved into the local Norn, which lingered until the end of the eighteenth century and Norse may also have survived as a spoken language until the sixteenth century in the Outer Hebrides. French, Flemish and particularly English became the main language of Scottish burghs, most of which were located in the south and east, an area to which Anglian settlers had already brought a form of Old English. In the later part of the twelfth century, the writer Adam of Dryburgh described lowland Lothian as "the Land of the English in the Kingdom of the Scots". At least from the accession of David I, Gaelic ceased to be the main language of the royal court and was probably replaced by French, as evidenced by reports from contemporary chronicles, literature and translations of administrative documents into the French language. After this "de-gallicisation" of the Scottish court, a less highly regarded order of bards took over the functions of the filidh and they would continue to act in a similar role in the Highlands and Islands into the eighteenth century. They often trained in bardic schools, of which a few, like the one run by the MacMhuirich dynasty, who were bards to the Lord of the Isles, existed in Scotland and a larger number in Ireland, until they were suppressed from the seventeenth century. Members of bardic schools were trained in the complex rules and forms of Gaelic poetry. Much of their work was never written down and what survives was only recorded from the sixteenth century.
In the late Middle Ages, Middle Scots, often simply called English, became the dominant language of the country. It was derived largely from Old English, with the addition of elements from Gaelic and French. Although resembling the language spoken in northern England, it became a distinct dialect from the late fourteenth century onwards. It began to be adopted by the ruling elite as they gradually abandoned French. By the fifteenth century it was the language of government, with acts of parliament, council records and treasurer's accounts almost all using it from the reign of James I onwards. As a result, Gaelic, once dominant north of the Tay, began a steady decline. Lowland writers began to treat Gaelic as a second class, rustic and even amusing language, helping to frame attitudes towards the highlands and to create a cultural gulf with the lowlands.
The establishment of Christianity brought Latin to Scotland as a scholarly and written language. Monasteries served as major repositories of knowledge and education, often running schools and providing a small educated elite, who were essential to create and read documents in a largely illiterate society. In the High Middle Ages new sources of education arose, with song and grammar schools. These were usually attached to cathedrals or a collegiate church and were most common in the developing burghs. By the end of the Middle Ages grammar schools could be found in all the main burghs and some small towns. Early examples including the High School of Glasgow in 1124 and the High School of Dundee in 1239. There were also petty schools, more common in rural areas and providing an elementary education. Some monasteries, like the Cistercian abbey at Kinloss, opened their doors to a wider range of students. The number and size of these schools seems to have expanded rapidly from the 1380s. They were almost exclusively aimed at boys, but by the end of the fifteenth century, Edinburgh also had schools for girls, sometimes described as "sewing schools", and probably taught by lay women or nuns. There was also the development of private tuition in the families of lords and wealthy burghers. The growing emphasis on education cumulated with the passing of the Education Act 1496, which decreed that all sons of barons and freeholders of substance should attend grammar schools to learn "perfyct Latyne". All this resulted in an increase in literacy, but which was largely concentrated among a male and wealthy elite, with perhaps 60 per cent of the nobility being literate by the end of the period.
Until the fifteenth century, those who wished to attend university had to travel to England or the continent, and just over a 1,000 have been identified as doing so between the twelfth century and 1410. Among these the most important intellectual figure was John Duns Scotus, who studied at Oxford, Cambridge and Paris and probably died at Cologne in 1308, becoming a major influence on late Medieval religious thought. After the outbreak of the Wars of Independence, with occasional exceptions under safe conduct, English universities were closed to Scots and continental universities became more significant. Some Scottish scholars became teachers in continental universities. At Paris this included John De Rate and Walter Wardlaw in the 1340s and 1350s, William de Tredbrum in the 1380s and Laurence de Lindores in the early 1500s. This situation was transformed by the founding of the University of St Andrews in 1413, the University of Glasgow in 1450 and the University of Aberdeen in 1495. Initially these institutions were designed for the training of clerics, but they would increasingly be used by laymen who would begin to challenge the clerical monopoly of administrative post in the government and law. Those wanting to study for second degrees still needed to go elsewhere and Scottish scholars continued to visit the continent and English universities reopened to Scots in the late fifteenth century. The continued movement to other universities produced a school of Scottish nominalists at Paris in the early sixteenth century, of which John Mair was probably the most important figure. He had probably studied at a Scottish grammar school, then Cambridge, before moving to Paris, where he matriculated in 1493. By 1497 the humanist and historian Hector Boece, born in Dundee and who had studied at Paris, returned to become the first principal at the new university of Aberdeen. These international contacts helped integrate Scotland into a wider European scholarly world and would be one of the most important ways in which the new ideas of humanism were brought into Scottish intellectual life.
Much of the earliest Welsh literature was actually composed in or near the country now called Scotland, in the Brythonic speech, from which Welsh would be derived, include The Gododdin and the Battle of Gwen Ystrad. There are also religious works in Gaelic including the Elegy for St Columba by Dallan Forgaill, c. 597 and "In Praise of St Columba" by Beccan mac Luigdech of Rum, c. 677. In Latin they include a "Prayer for Protection" (attributed to St Mugint), c. mid-sixth century and Altus Prosator ("The High Creator", attributed to St Columba), c. 597. In Old English there is The Dream of the Rood, from which lines are found on the Ruthwell Cross, making it the only surviving fragment of Northumbrian Old English from early Medieval Scotland. Before the reign of David I, the Scots possessed a flourishing literary elite that produced texts in both Gaelic and Latin, a tradition that survived in the Highlands into the thirteenth century. It is possible that more Middle Irish literature was written in Medieval Scotland than is often thought, but has not survived because the Gaelic literary establishment of eastern Scotland died out before the fourteenth century. In the thirteenth century, French flourished as a literary language, and produced the Roman de Fergus, the earliest piece of non-Celtic vernacular literature to survive from Scotland.
The first surviving major text in Early Scots literature is John Barbour's Brus (1375), composed under the patronage of Robert II and telling the story in epic poetry of Robert I's actions before the English invasion till the end of the war of independence. Much Middle Scots literature was produced by makars, poets with links to the royal court, which included James I (who wrote The Kingis Quair). Many of the makars had a university education and so were also connected with the Kirk. However, Dunbar's Lament for the Makaris (c.1505) provides evidence of a wider tradition of secular writing outside of Court and Kirk, now largely lost. Before the advent of printing in Scotland, writers such as Robert Henryson, William Dunbar, Walter Kennedy and Gavin Douglas have been seen as leading a golden age in Scottish poetry. In the late fifteenth century, Scots prose also began to develop as a genre. Although there are earlier fragments of original Scots prose, such as the Auchinleck Chronicle, the first complete surviving work includes John Ireland's The Meroure of Wyssdome (1490). There were also prose translations of French books of chivalry that survive from the 1450s, including The Book of the Law of Armys and the Order of Knychthode and the treatise Secreta Secetorum, an Arabic work believed to be Aristotle's advice to Alexander the Great. The landmark work in the reign of James IV was Gavin Douglas's version of Virgil's Aeneid, the Eneados, which was the first complete translation of a major classical text in an Anglian language, finished in 1513, but overshadowed by the disaster at Flodden.
In the early middles ages, there were distinct material cultures evident in the different linguistic groups, federations and kingdoms within what is now Scotland. Pictish art can be seen in the extensive survival of carved stones, particularly in the north and east of the country, which hold a variety of recurring images and patterns, as at Dunrobin (Sutherland) and Aberlemno stones (Angus). It can also be seen in elaborate metal work that largely survives in buried hordes like the St Ninian's Isle Treasure. Irish-Scots art from the Kingdom of Dál Riata is much more difficult to identify, but may include items like the Hunterston brooch, which with other items like the Monymusk Reliquary, suggest that Dál Riata was one of the places, as a crossroads between cultures, where the Insular style developed. Insular art is the name given to the common style that developed in Britain and Ireland after the conversion of the Picts and the cultural assimilation of Pictish culture into that of the Scots and Angles, and which became highly influential in continental Europe, contributing to the development of Romanesque and Gothic styles. It can be seen in elaborate jewellery, often making extensive use of semi-precious stones, in the heavily carved High crosses found most frequently in the Highlands and Islands, but distributed across the country and particularly in the highly decorated illustrated manuscripts such as the Book of Kells, which may have been begun, or wholly created on Iona. The finest era of the style was brought to an end by the disruption to monastic centres and aristocratic life of the Viking raids in the late eighth century.
Scotland adopted the Romanesque in the late twelfth century, retaining and reviving elements of its style after the Gothic had become dominant elsewhere from the thirteenth century. Much of the best Scottish artwork of the High and Late Middle Ages was either religious in nature or realised in metal and woodwork, and has not survived the impact of time and of the Reformation. However, examples of sculpture are extant as part of church architecture, including evidence of elaborate church interiors like the sacrament houses at Deskford and Kinkell and the carvings of the seven deadly sins at Rosslyn Chapel. From the thirteenth century, there are relatively large numbers of monumental effigies like the elaborate Douglas tombs in the town of Douglas. Native craftsmanship can be seen in items like the Bute mazer and the Savernake Horn, and more widely in the large number of high quality seals that survive from the mid thirteenth century onwards. Visual illustration can be seen in the illumination of charters, and occasional survivals like the fifteenth century Doom painting at Guthrie. Surviving copies of individual portraits are relatively crude, but more impressive are the works or artists commissioned from the continent, particularly the Netherlands, including Hugo van Der Goes's altarpiece for the Trinity College Church in Edinburgh and the Hours of James IV of Scotland.
Medieval vernacular architecture utilised local building materials, including cruck constructed houses, turf walls and clay, with a heavy reliance on stone. As burghs developed there were more sophisticated houses for the nobles, burgesses and other inhabitants. By the end of the period some were stone built with slate roofs or tiles. Medieval parish church architecture was typically simpler than in England, with many churches remaining simple oblongs, without transepts and aisles, and often without towers. From the eleventh century there were influences from English and continental European designs and grander ecclesiastical buildings were built in the Romanesque style, as can be seen at Dunfermline Abbey and Elgin Cathedral, and later the Gothic style as at Glasgow Cathedral and in the rebuilding of Melrose Abbey. From the early fifteenth century the introduction of Renaissance styles included the selective return of Romanesque forms, as in the nave of Dunkeld Cathedral and in the chapel of Bishop Elphinstone's Kings College, Aberdeen (1500-09). Many of the motte and bailey castles introduced into Scotland with feudalism in the twelfth century and the castles "enceinte", with a high embattled curtain wall that replaced those still in occupation, were slighted during the Wars of Independence. In the late Middle Ages new castles were built, some on a grander scale as "livery and maintenance" castles, to house retained troops.Gunpowder weaponry fundamentally altered the nature of castle architecture, with existing castles being adapted to allow the use of gunpowder weapons by the incorporation of "keyhole" gun ports, platforms to mount guns and walls being adapted to resist bombardment. Ravenscraig, Kirkcaldy, begun about 1460, is probably the first castle in the British Isles to be built as an artillery fort, incorporating "D-shape" bastions that would better resist cannon fire and on which artillery could be mounted. The largest number of late medieval fortifications in Scotland built by nobles were of the tower house design. primarily aimed to provide protection against smaller raiding parties, rather than a major siege. Extensive building and rebuilding of royal palaces in the Renaissance style probably began under James III and accelerated under James IV. Linlithgow was first constructed under James I, under the direction of master of work John de Waltoun and was referred to as a palace, apparently the first use of this term in the country, from 1429. This was extended under James III and began to correspond to a fashionable quadrangular, corner-towered Italian signorial palace, combining classical symmetry with neo-chivalric imagery.
In the late twelfth century, Giraldus Cambrensis noted that "in the opinion of many, Scotland not only equals its teacher, Ireland, but indeed greatly outdoes it and excels her in musical skill". He identified the Scots as using the cithara, tympanum and chorus, although what exactly these instruments were is unclear. Bards probably accompanied their poetry on the harp, and can also be seen in records of the Scottish courts throughout the Medieval period. Scottish church music from the thirteenth century was increasingly influenced by continental developments, with figures like the musical theorist Simon Tailler studying in Paris, before returned to Scotland where he introduced several reforms of church music. Scottish collections of music like the thirteenth century 'Wolfenbüttel 677', which is associated with St Andrews, contain mostly French compositions, but with some distinctive local styles. The captivity of James I in England from 1406 to 1423, where he earned a reputation as a poet and composer, may have led him to take English and continental styles and musicians back to the Scottish court on his release. In the late fifteenth century a series of Scottish musicians trained in the Netherlands before returning home, including John Broune, Thomas Inglis and John Fety, the last of whom became master of the song school in Aberdeen and then Edinburgh, introducing the new five-fingered organ playing technique. In 1501 James IV refounded the Chapel Royal within Stirling Castle, with a new and enlarged choir and it became the focus of Scottish liturgical music. Burgundian and English influences were probably reinforced when Henry VII's daughter Margaret Tudor married James IV in 1503.
In the High Middle Ages the word "Scot" was only used by Scots to describe themselves to foreigners, amongst whom it was the most common word. They called themselves Albanach or simply Gaidel. Both "Scot" and Gaidel were ethnic terms that connected them to the majority of the inhabitants of Ireland. At the beginning of the thirteenth century, the author of De Situ Albanie noted that: "The name Arregathel [Argyll] means margin of the Scots or Irish, because all Scots and Irish are generally called 'Gattheli'." Scotland came to possess a unity which transcended Gaelic, French and Germanic ethnic differences and by the end of the period, the Latin, French and English word "Scot" could be used for any subject of the Scottish king. Scotland's multilingual Scoto-Norman monarchs and mixed Gaelic and Scoto-Norman aristocracy all became part of the "Community of the Realm", in which ethnic differences were less divisive than in Ireland and Wales. This identity was defined in opposition to English attempts to annexe the country and as a result of social and cultural changes. The resulting antipathy towards England dominated Scottish foreign policy well into the fifteenth century, making it extremely difficult for Scottish kings like James III and James IV to pursue policies of peace towards their southern neighbour. In particular the Declaration of Arbroath asserted the ancient distinctiveness of Scotland in the face of English aggression, arguing that it was the role of the king to defend the independence of the community of Scotland. This document has been seen as the first "nationalist theory of sovereignty".
The adoption of Middle Scots by the aristocracy has been seen as building a shared sense of national solidarity and culture between rulers and ruled, although the fact that north of the Tay Gaelic still dominated may have helped widen the cultural divide between highlands and lowlands. The national literature of Scotland created in the late medieval period employed legend and history in the service of the crown and nationalism, helping to foster a sense of national identity, at least within its elite audience. The epic poetic history of the Brus and Wallace helped outline a narrative of united struggle against the English enemy. Arthurian literature differed from conventional versions of the legend by treating Arthur as a villain and Mordred, the son of the king of the Picts, as a hero. The origin myth of the Scots, systematised by John of Fordun (c. 1320-c. 1384), traced their beginnings from the Greek prince Gathelus and his Egyptian wife Scota, allowing them to argue superiority over the English, who claimed their descent from the Trojans, who had been defeated by the Greeks. The image of St. Andrew, martyred while bound to an X-shaped cross, first appeared in the Scotland during the reign of William I and was again depicted on seals used during the late thirteenth century; including on one particular example used by the Guardians of Scotland, dated 1286. Use of a simplified symbol associated with Saint Andrew, the saltire, has its origins in the late fourteenth century; the Parliament of Scotland decreed in 1385 that Scottish soldiers should wear a white Saint Andrew's Cross on their person, both in front and behind, for the purpose of identification. Use of a blue background for the Saint Andrew's Cross is said to date from at least the fifteenth century. The earliest reference to the Saint Andrew's Cross as a flag is to be found in the Vienna Book of Hours, circa 1503.