The Regiam Majestatem is the earliest surviving work giving a comprehensive digest of the Law of Scotland. The name of the document is derived from its first two words. It consists of four books, treating (1) civil actions and jurisdictions, (2) judgments and executions, (3) contracts, and (4) crimes.
Dating from the early fourteenth century, it is largely based on the 1188 Tractatus de legibus et consuetudinibus regni Angliae (Treatise on the laws and customs of the Kingdom of England) of Ranulf de Glanvill, and incorporates features of thirteenth century canon law, the Summa in Titulos Decretalium of Goffredus of Trano, and the Scottish Celtic Laws of the Brets and Scots.
The documentary basis of Scots law had been largely destroyed by the confiscations of Edward I of England in the thirteenth century and by two devastating English invasions led by Edward I and Edward III in the thirteenth and fourteenth centuries. When the Regiam Majestatem was discovered in the early fifteenth century after Scotland's legal provenance had been destroyed, it was immediately embraced as an authoritative source of law, surviving as such into the modern era.
Sir John Skene had compiled and edited versions of the document at his own expense, and this was published by the Parliament of Scotland in 1609. Skene's version is not entirely consistent with the original document, but it held up as the standard version. Later legal references to the document are references to the 1609 publication.
The Regiam Majestatem was written perhaps as early as the time of Robert the Bruce (reigned 1306 – 1329), and certainly later than 1318, as a statute from that date was included in it. The details of how this was accomplished are unknown, as is the identity of the author.
In the events leading up to his invasion of Scotland, Edward I of England (reigned 1272 – 1307) forced himself upon Scotland in the role of feudal overlord, far beyond the guiding and consultative role that the Scots had asked him to play. During this time he signed a writ in 1291 that required the collection of all documents that might concern his own claims of superiority over Scotland, or the claims of others. The writ was executed, and between that and the depredations during Edward's invasion of Scotland in 1296, virtually every important Scottish legal document was lost forever.