Lochmaben Castle is a ruined castle in the town of Lochmaben, the feudal Lordship of Annandale, and the united county of Dumfries and Galloway. It was built by Edward I in the 13th and 14th centuries, and later rebuilt during the reign of James IV of Scotland. An earlier motte-and-bailey castle was built south of the current castle in c. 1160 by the Bruce family, Lords of Annandale.