Lochmaben is a small town in Scotland, and site of a once-important castle. It lies four miles west of Lockerbie, in Dumfries and Galloway.
The name Loch Mhabain is possibly a corruption of Loch Mhaol Bheinn ("Lake on the bare mountain"), or may mean "Loch of Mabon", an ancient Brythonic god, as the Roman name of the area was Locus Maponi, according to the Ravenna Cosmography. It has been inhabited since earliest times due to its strategic position on the routes from England to Scotland and Ireland, to the small lochs surrounding it and to the relatively fertile soil in the area. The first inhabitants may have lived in crannogs in the lochs.
It was also a Civil Parish in Dumfriesshire, in the area of the District of Dumfries and Galloway.
After the Roman departure the area around Dumfries the locale had various forms of visit by Picts, Saxons, Scots and Danes culminating in a decisive victory for Giric mac Dungail (Modern Gaelic: Griogair mac Dhunghail, known in English simply as Giric and nicknamed Mac Rath ("Son of Fortune"); fl. c. 878-889) was a king of the Picts or the king of Alba at what is now Lochmaben over the native Britons in 890.
By 1160, the Anglo-Norman de Brus (Bruce) family, had become the Lords of Annandale. Robert de Brus Lord of Skelton in the Cleveland area of Yorkshire, was a notable figure at the court of King Henry I of England, where he became intimate with Prince David of Scotland, that monarch's brother-in-law. When the Prince became King David I of Scotland, in 1124, Bruce obtained from him the Lordship of Annandale, and great possessions in the south of Scotland. (de Brus was nevertheless buried at Guisborough, the place of his birth). By the 15th century the Lordship was in the hands of Alexander Stewart, Duke of Albany etc., (d.1485). Following his death it, and the castle of Lochmaben, were annexed to the Crown by Act of Parliament dated 1 October 1487.