 = Ímar mac Arailt = 
 
 Ímar mac Arailt ( died 1054 ) was an eleventh @-@ century ruler of the Kingdom of Dublin and perhaps the Kingdom of the Isles . He was the son of a man named Aralt , and appears to have been a grandson of Amlaíb Cuarán , King of Northumbria and Dublin . Such a relationship would have meant that Ímar was a member of the Uí Ímair , and that he was a nephew of Amlaíb Cuarán 's son , Sitriuc mac Amlaíb , King of Dublin , a man driven from Dublin by Echmarcach mac Ragnaill in 1036 . 
 Ímar 's reign in Dublin spanned at least eight years , from 1038 to 1046 . Although he began by seizing the kingship from Echmarcach in 1038 , he eventually lost it to him in 1046 . As king , Ímar is recorded to have overseen military operations throughout Ireland , and seems to have actively assisted the family of Iago ab Idwal ap Meurig , King of Gwynedd overseas in Wales . After Echmarcach 's final expulsion from Dublin 1052 , Ímar may well have been reinstalled as King of Dublin by Diarmait mac Maíl na mBó , King of Leinster . Whatever the case , Ímar died in 1054 . He may have been an ancestor or close kinsman of Gofraid Crobán , King of Dublin and the Isles , the progenitor of a family that ruled in the Isles until the mid thirteenth century . 
 
 = = Familial background = = 
 
 Ímar was probably the son of Aralt mac Amlaíb ( died 999 ) , a man whose death at the Battle of Glenn Máma is recorded by the Annals of Clonmacnoise , the Annals of the Four Masters , the Annals of Ulster , and Chronicon Scotorum . If this identification is correct , Ímar 's paternal grandfather would have been Amlaíb Cuarán , King of Northumbria and Dublin ( died 980 / 981 ) , and a paternal uncle of Ímar would have been Sitriuc mac Amlaíb , King of Dublin ( died 1042 ) . 
 
 = = Struggle for Dublin = = 
 
 Ímar 's probable uncle , Sitriuc , ruled Dublin for almost fifty years between 989 and 1036 . There is reason to suspect that the latter 's realm included Mann by the second or third decade of the eleventh century . His reign in Dublin was finally put to an end by Echmarcach mac Ragnaill ( died 1064 / 1065 ) , who drove Sitriuc from the coastal town and claimed the kingship for himself . Previously , Sitriuc seems to have been closely aligned with Knútr Sveinnsson ( died 1035 ) , ruler of the kingdoms of England , Denmark , and Norway . Knútr 's apparent authority in the Irish Sea region , coupled with Sitriuc 's seemingly close connections with him , could account for the remarkable security enjoyed by Sitriuc during Knútr 's reign . It is possible that Echmarcach had been bound from taking action against Sitriuc whilst Knútr held power , and that the confusion caused by the latter 's death in 1035 enabled Echmarcach to exploit the situation and seize control of the Irish Sea region . Although there is no direct evidence that Echmarcach controlled Mann by this date , Sitriuc does not appear to have taken refuge on the island after his expulsion from Dublin . This seems to suggest that the island was outside Sitriuc 's possession , and may indicate that Mann had fallen into the hands of Echmarcach sometime before . In fact , it is possible that Echmarcach used the island to launch his takeover of Dublin . 
 Echmarcach 's hold on Dublin was short @-@ lived as the Annals of Tigernach records that Ímar replaced him as King of Dublin in 1038 . This annal @-@ entry has been interpreted to indicate that Ímar drove Echmarcach from the kingship . There is reason to suspect that Þórfinnr Sigurðarson , Earl of Orkney ( died c . 1065 ) extended his presence into the Isles and the Irish Sea region at about this period . The evidence of Þórfinnr 's power in the Isles could suggest that he possessed an active interest in the ongoing struggle over the Dublin kingship . In fact , Þórfinnr 's predatory operations in the Irish Sea region may have contributed to Echmarcach 's loss of Dublin in 1038 . 
 It is conceivable that Ímar received some form of support from Knútr 's son and successor in Britain , Haraldr Knútsson , King of England ( died 1040 ) . The latter was certainly in power when Ímar replaced Echmarcach , and an association between Ímar and Haraldr could explain why the Annals of Ulster reports the latter 's death two years later . Ímar 's reign lasted about eight years , and one of his first royal acts appears to have been the invasion of Rathlin Island within the year . The fact that he proceeded to campaign in the North Channel could indicate that Echmarcach had held power in this region before his acquisition of Mann and Dublin . 
 In 1044 , the Annals of Tigernach records that Ímar penetrated into the domain of the Uí Fhíachrach Arda Sratha and killed their chief . The annal @-@ entry also indicates that Ímar stormed the church of Armagh , and burned Scrín Pátraic ( the " Shrine of Patrick " ) in the attack . The following year , he again invaded Rathlin Island , and his subsequent slaughter of three hundred noblemen of the Ulaid , including a certain heir apparent named Ragnall Ua Eochada , is documented by the Annals of Clonmacnoise , the Annals of Inisfallen , the Annals of Tigernach , and the Annals of the Four Masters . This remarkable action may indicate that the Dubliners and Ulaid were battling for control of Rathlin Island . If so , it could be evidence that Ímar enjoyed the possession of Mann by this date . The domain of the Ulaid is certainly the closest Irish territory to Mann , and the control of the Manx fleet could account for the Dubliner 's ability to challenge the Ulaid . Whatever the case , within the year Niall mac Eochada , King of Ulaid ( died 1063 ) is recorded to have attacked Fine Gall — Dublin 's agriculturally @-@ rich northern hinterland — in what may have been a retaliatory raid . 
 The following year , the Annals of Tigernach states that Echmarcach succeeded Ímar . The Annals of the Four Masters specifies that Ímar was driven from the kingship by Echmarcach , who was then elected king by the Dubliners . After this point in Ímar 's life , all that is known for certain is that he died in 1054 , as recorded by the Annals of Ulster and the Annals of Loch Cé . Nevertheless , since these sources style Ímar in Gaelic rí Gall ( " king of the foreigners " ) , there may be evidence to suggest that , when Diarmait mac Maíl na mBó , King of Leinster ( died 1072 ) drove Echmarcach from Dublin in 1052 , Diarmait reinstalled Ímar as king . 
 After Ímar 's death , Diarmait appears to have appointed his own son , Murchad ( died 1070 ) , control of Dublin later that decade , as the Annals of the Four Masters accords him the title tigherna Gall , meaning " lord of the foreigners " in 1059 . In 1061 , Murchad invaded Mann and seems to have overthrown Echmarcach . Both father and son were dead by 1072 , and the Annals of Tigernach describes Diarmait on his death that year as King of the Isles ( rí Innsi Gall , literally " king of the isles of the foreigners " ) , a declaration which seems to indicate that , by the eleventh century at least , the kingship of the Isles was contingent upon control of Mann . 
 
 = = Involvement in Wales = = 
 
 The principal Welsh monarch during Ímar 's reign was Gruffudd ap Llywelyn ( died 1063 / 1064 ) . One of the latter 's main rivals was Iago ab Idwal ap Meurig , King of Gwynedd ( died 1039 ) , a man who had killed Gruffudd 's father in 1023 , and thenceforth ruled Gwynedd until his own demise in 1039 . Gruffudd himself may have been responsible for Iago 's slaying , and certainly succeeded to the kingship of Gwynedd after his death . It was likely in the context of Iago 's fall and this resulting regime change that the latter 's son , Cynan ( fl . 1064 ) , fled overseas and sought refuge in Dublin . 
 According to Historia Gruffud vab Kenan , the mother of Cynan 's son was Ragnailt ingen Amlaíb , a paternal granddaughter of Sitriuc . Further revealed by this source is the fact that this woman 's father , Amlaíb mac Sitriuc , built and commanded a Welsh fortress called Castell Avloed . Although it is unknown how long the Dubliners possessed the fortress , in 1036 another son of Sitriuc was slain in Wales by an apparent kinsman , an event which could be evidence of a struggle for control of the site . Echmarcach 's aforesaid expulsion of Sitriuc from Dublin in the same year could in turn indicate that this exiled monarch sought refuge in Wales . 
 Despite the uncertainty of its specific location , Castell Avloed appears to have been situated in territory formerly controlled by Iago , and there is reason to suspect that — after Iago 's fall and Cynan 's flight — Ímar oversaw military actions against Gruffudd . Three years later , for example , Brut y Tywysogion and the " B " and " C " versions of Annales Cambriæ report that this Welsh king was captured by forces from Dublin . The episode is further elaborated upon by a sixteenth @-@ century text compiled by David Powell ( died 1598 ) and a seventeenth @-@ century text by compiled by James Ware . According to these admittedly late versions of events , Gruffudd was captured by the Dubliners in the context of them supporting the cause of Cynan . The accounts further state that Gruffudd managed to escape his captors when the Dubliners were counterattacked by Welsh forces before they could return to Ireland . The evidence of Cynan cooperating with the Dubliners against Gruffudd suggests that , not only was Ímar personally involved as king , but that the Welsh fortress of Castell Avloed was still controlled by the Dubliners . 
 Another conflict that could have involved Ímar and the military forces of Dublin was Gruffudd 's final defeat of Hywel ab Edwin , King of Deheubarth ( died 1044 ) . According to Brut y Tywysogion and the " B " version of Annales Cambriæ this last stand of Hywel took place at the mouth of the River Tywi — perhaps in the vicinity of Carmarthen — and included Vikings from Ireland who supported Hywel 's cause . It is apparent that Gruffudd 's adversaries generally utilised foreign military support from Ireland 's Viking enclaves . Certainly , the Book of Llandaff declares that Gruffudd struggled against English , Irish , and Vikings during his career . 
 
 = = Ancestral figure = = 
 
 Ímar may have been the father , uncle , or possibly even the brother of Gofraid Crobán , King of Dublin and the Isles ( died 1095 ) . In 1091 , the Annals of Tigernach reveals that Gofraid possessed the kingship of Dublin in an annal @-@ entry recording his patronym as " ... mac Maic Arailt " . The Chronicle of Mann , on the otherhand , gives Gofraid 's patronym as " ... filius Haraldi nigri de Ysland " . Whilst the former source identifies Gofraid as the son of a man named Aralt ( Old Norse Haraldr ) , the latter identifies Gofraid as the paternal grandson of a man so named . 
 In the aforesaid record of the military actions conducted in 1044 , Ímar is merely named as the son of Aralt , a fact which could indicate that this was how he was known to his contemporaries . If correct , the patronym preserved by the Chronicle of Mann could merely be a garbled form of this style . 
 The patronym given by the Chronicle of Mann states that Gofraid 's father was from " Ysland " , a place which could refer to either Iceland , Islay , or Ireland . Other than this passage , there is no evidence hinting of a connection between Gofraid and Iceland . The chronicle elsewhere states that Gofraid died on Islay , although the island 's name is rendered " Ile " in this case . If " Ysland " instead refers to Ireland , the spelling could be the result of influence from a source originating in England , or a source written in Mediaeval French . 
 
 