The Kingdom of Scotland (Scottish Gaelic: Rìoghachd na h-Alba; Scots: Kinrick o Scotland) was a sovereign state in northwest Europe traditionally said to have been founded in 843. Its territories expanded and shrank, but it came to occupy the northern third of the island of Great Britain, sharing a land border to the south with the Kingdom of England. It suffered many invasions by the English, but under Robert I it fought a successful war of independence and remained an independent state throughout the late Middle Ages. In 1603, James VI of Scotland became King of England, joining Scotland with England in a personal union. In 1707, the two kingdoms were united to form the Kingdom of Great Britain under the terms of the Acts of Union. Following the annexation of the Northern Isles from the Kingdom of Norway in 1472 and final capture of the Royal Burgh of Berwick by the Kingdom of England in 1482, the territory of the Kingdom of Scotland corresponded to that of modern-day Scotland, bounded by the North Sea to the east, the Atlantic Ocean to the north and west, and the North Channel and Irish Sea to the southwest.
The Crown was the most important element of government. The Scottish monarchy in the Middle Ages was a largely itinerant institution, before Edinburgh developed as a capital city in the second half of the 15th century. The Crown remained at the centre of political life and in the 16th century emerged as a major centre of display and artistic patronage, until it was effectively dissolved with the Union of Crowns in 1603. The Scottish Crown adopted the conventional offices of western European monarchical states of the time and developed a Privy Council and great offices of state. Parliament also emerged as a major legal institution, gaining an oversight of taxation and policy, but was never as central to the national life. In the early period, the kings of the Scots depended on the great lords—the mormaers and toísechs—but from the reign of David I, sheriffdoms were introduced, which allowed more direct control and gradually limited the power of the major lordships. In the 17th century, the creation of Justices of Peace and Commissioners of Supply helped to increase the effectiveness of local government. The continued existence of courts baron and the introduction of kirk sessions helped consolidate the power of local lairds.
Scots law developed in the Middle Ages and was reformed and codified in the 16th and 17th centuries. Under James IV the legal functions of the council were rationalised, with Court of Session meeting daily in Edinburgh. In 1532, the College of Justice was founded, leading to the training and professionalisation of lawyers. David I is the first Scottish king known to have produced his own coinage. At the union of the Crowns in 1603 the Pound Scots was fixed at only one-twelfth the value of the English pound. The Bank of Scotland issued pound notes from 1704. Scottish currency was abolished by the Act of Union, however to the present day, Scotland retains unique banknotes.
Geographically, Scotland is divided between the Highlands and Islands and the Lowlands. The Highlands had a relatively short growing season, which was further shortened during the Little Ice Age. From Scotland's foundation to the inception of the Black Death, the population had grown to a million; following the plague, it then fell to half a million. It expanded in the first half of the 16th century, reaching roughly 1.2 million by the 1690s. Significant languages in the medieval kingdom included Gaelic, Old English, Norse and French; but by the early modern era Middle Scots had begun to dominate. Christianity was introduced into Scotland from the 6th century. In the Norman period the Scottish church underwent a series of changes that led to new monastic orders and organisation. During the 16th century, Scotland underwent a Protestant Reformation that created a predominately Calvinist national kirk. There were a series of religious controversies that resulted in divisions and persecutions. The Scottish Crown developed naval forces at various points in its history, but often relied on privateers and fought a guerre de course. Land forces centred around the large common army, but adopted European innovations from the 16th century; and many Scots took service as mercenaries and as soldiers for the English Crown.
From the 5th century AD, north Britain was divided into a series of petty kingdoms. Of these, the four most important were those of the Picts in the north-east, the Scots of Dál Riata in the west, the Britons of Strathclyde in the south-west and the Anglian kingdom of Bernicia (which united with Deira to form Northumbria in 653) in the south-east, stretching into modern northern England. In AD 793, ferocious Viking raids began on monasteries such as those at Iona and Lindisfarne, creating fear and confusion across the kingdoms of north Britain. Orkney, Shetland and the Western Isles eventually fell to the Norsemen. These threats may have speeded up 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 kingdoms, although historians debate whether it was a Pictish takeover of Dál Riata, or the other way round. This culminated in the rise of Cínaed mac Ailpín (Kenneth MacAlpin) as "king of the Picts" in the 840s (traditionally dated to 843), which brought to power the House of Alpin. When he died as king of the combined kingdom in 900 one of his successors, Domnall II (Donald II), was the first man to be called rí Alban (King of Alba). The term Scotia would increasingly be used to describe the heartland of these kings, north of the River Forth, and eventually the entire area controlled by its kings would be referred to as Scotland. The long reign (900–942/3) of Donald's successor Causantín (Constantine II) is often regarded as the key to formation of the Kingdom of Alba/Scotland, and he was later credited with bringing Scottish Christianity into conformity with the Catholic Church.