The Kingdom of Scotland traces to the 9th-century realm of Alba (Picts and Gaels together), with Kenneth MacAlpin's accession of 843 traditionally its founding. Through the Middle Ages it wrestled England: William Wallace won at Stirling Bridge (1297), Robert the Bruce at Bannockburn (1314), the Declaration of Arbroath (1320) claimed the nation's independence, acknowledged in 1328. The Stuart line ruled long; after the truce of 1502, Elizabeth I died without issue in 1603 and James VI added the English crown - two kingdoms under one sovereign, unmerged. The Act of Union of 1707 joined England and Scotland into the Kingdom of Great Britain, dissolving Scotland's parliament (restored 1999) and closing 864 years of the kingdom.
Editorial note on dating Personal union with England from 1603 (James VI); merged into Great Britain in 1707; 'after' marks the merge partner for lane adjacency.