This article needs additional citations for verification. (November 2009) (Learn how and when to remove this template message)
The Arms of the Realm and Ancient Local Principalities of Scotland 
The lords of Galloway consisted of a dynasty of heirs who were lords (or kings) and ladies who ruled over Galloway in southwest Scotland, mainly during the High Middle Ages. Many regions of Scotland, including Galloway and Moray, periodically had kings or subkings, similar to those in Ireland during the Middle Ages. The Scottish monarch was seen as being similar to a high king (Ard-Righ in Gaelic). The lords of Galloway would have either paid tribute to the Scottish monarch, or at other times ignored him. The Lords of Galloway are fairly well recorded in the 12th and 13th centuries, but the records are incomplete or conflicting at other times. Later on, the kings were known as "lords" at the Scottish court, and "kings" at home, finally becoming "lords" in both arenas.
The boundaries of the Kingdom of Galloway were ill-defined, and varied over time. During many periods Galloway was much larger than it is today, and took in parts of southern Ayrshire, such as Carrick, Upper Douglasdale and Nithsdale. The area appears to have been the main bastion of Scottish Gaelic culture south of the Highlands in medieval times.
Suibne mac Cináeda (d.1034) is the first recorded king of the Gall-ghàidhil, the people of Galloway, although it is not until about 1138 that the succession is properly recorded. The Dynasty of Fergus appears to have continued until 1234 and the Laws of Galloway remained in force until 1426. It is thought that these laws originally derived their authority from the kings of Galloway.
Contrary to some popular conceptions, there is no evidence that Galloway was ever part of the Kingdom of Strathclyde. Thus Galloway (west of the Nith at least) lay outside the traditional area claimed by the Kingdom of Alba, Strathclyde's successor state in the area. Galloway, often defined as all of the area to the south and west of the Clyde and west of the River Annan, lay outside traditional Scottish territory. Though it formed part of the northern mainland of Britain, Galloway was just as much a part of the Irish Sea; part of that Hiberno-Norse world of the Gall-Gaidhel lords of the Isle of Man, Dublin and the Hebrides. The ex-King of Dublin and Man, Echmarcach mac Ragnaill, had the title Rex Innarenn (possibly "King of the Rhinns") attributed to him on his death in 1065. The western sections of Galloway had been firmly aligned with the Isle of Man, and Norse and Gaelic-Norse settlement names from the 10th and 11th centuries are spread all along the coastal lands of south-western "Scotland" and north-western "England".
In the late 11th century, the Norwegian King Magnus III Berrføtt ("Barefoot") led a campaign of subjugation in the Irish Sea world. In 1097, he sent his vassal, Ingimundr, to take control of the Kingdom of the Isles. However, when this man was killed, Magnus himself launched the first of his two invasions, the campaigns of 1098-1099 and of 1102-1103. In the former campaign, he took control of the Western Isles of Scotland, and deposed King Lagmann of Man. (Incidentally, this campaign also brought him to Wales, where he killed the Earl of Chester and the Earl of Shrewsbury, who were at war with the Prince of Gwynedd). In this campaign, Magnus almost certainly brought Galloway under his suzerainty too. Magnus, moreover, gained the recognition of these conquests from the then-king of Alba, Etgair mac Maíl Coluim.
On his second campaign, Magnus went to Man, and with a huge fleet attacked Dublin and attempted to bring the submission of Muircertach mac Toirrdelbach, the Uí Briain King of Munster. The campaign resulted in an alliance between the two kings, and the arranged marriage of Magnus' son Siguðr to Muircertach's daughter Bjaðmunjo. The alliance mitigated the threat of Domnall Ua Lochlainn, King of Ailech, bringing stability to the Irish Sea world, and security to Magnus' new Irish Sea "Empire." However, it all went wrong when Magnus was killed on his way back to Norway on a minor raid in Ulster. Much of Magnus' work lay in ruins.
Fergus of Galloway took the throne of Galloway some time between 1110 and 1120. When he died in 1161 Fergus left Galloway to his two sons, Uchtred and Gille Brigte (Gilbert). In 1174 Uchtred died after being brutally blinded and mutilated by his brother Gille Brigte and Gille Brigte's son, Máel Coluim (Malcolm). When Gilla Brigte died a few years later, it was Uchtred's son Lochlann (Roland) who took possession of Galloway. Gilla Brigte's surviving son Donnchad (Duncan) was made 1st Earl/Mormaer of Carrick.
Lochlann married Helen, the daughter of Richard de Moreville, Constable of Scotland, and inherited his father-in-law's title. Their son Alan of Galloway was the most powerful of the lords and upon his death in 1234, his holdings were divided between his three daughters and their husbands. However, an attempt was made, within Galloway, to establish Alan's illegitimate son, Thomas as ruler, but this failed when King Alexander II of Scotland broke the line of rejected such claim for an illegitimate son to take over. In response Gille Ruadh led a revolt against Alexander. The attempt failed resulting in Galloway being divided amongst Alan's three living daughters who were married to the Frenchmen, Roger de Quincy (married to Ela), John de Balliol (married to Derborgaill) and William de Forz (married to Cairistiona). Galloway's period as an independent political entity eventually came to an end with John de Balliol delegated as Lord.
In 1369, Archibald the Grim, had been appointed Lord of Galloway by David II of Scotland, "becaus he tuke git trawell to purge the cuntrey of Englis blude". Later he would construct his mighty fortress of Thrieve, near present-day Castle Douglas.