Cogad Gáedel re Gallaib ("The War of the Irish with the Foreigners") is a medieval Irish text that tells of the depredations of the Vikings and Uí Ímair dynasty in Ireland and the Irish king Brian Boru's great war against them, beginning with the Battle of Sulcoit in 967 and culminating in the Battle of Clontarf in 1014, in which Brian was slain but his forces were victorious. The chronicle, which compares King Brian to Augustus and Alexander the Great, was written in the early twelfth century, at least a hundred years after the events it describes. Much of the narrative is drawn from the earlier Annals of Ulster.

Date
Based on internal evidence and on the nature of the text's allusions to Brian's great-grandson Muirchertach Ua Briain (d. 1119), it has been suggested that the work was composed sometime between 1103 and 1111. Cogad Gáedel re Gallaib has been found in three texts. These three are the Books of Leinster c. 1160, the Dublin Manuscript dated to the fourteenth century and the Brussels Manuscript from 1635.

Characterization of Brian and the foreigners
The author makes extensive use of long, elaborate passages that describe and highlight the contrast between the Irish king Brian and the foreign army he wars against. Brian and his followers are described in terms of their virtue and courage, often emphasising their Christian background and piety: 

The text goes on to say that Brian and his Dál gCais are comparable to Augustus and Alexander the Great, even going on to suggest that Brian's son Murchadh "was the metaphorical Hector of all-victorious Erinn, in religion, and in valour, and in championship, in generosity, and in munificence." The text draws heavily on figures of mythology and the Bible, attributing characteristics of Hercules and Samson to Murchadh. An aspect of the work's style that is lost in translation is the heavy-handed use of alliteration. When setting the scene for the Battle of Clontarf, there is a digression to describe the armament of the Dál gCais which consists of a series of twenty-seven adjectives, grouped in strings of alliterative words.

In contrast with the lavish praise bestowed on the Dál gCais, the text describes the Vikings with vehemence and condemnation, though in terms no less hyperbolic:

The text's censure of the foreigners elevates the Irish and Brian even further, setting up a striking difference in moral and religious character between the two groups.

Political purpose
The main purpose of the chronicle seems to be to eulogise Brian Boru and thereby to show that the record of achievements of Brian's Dál gCais dynasty proved that they deserved Ireland's high kingship. This was an issue because the Ua Briain sept of the Dál gCais was struggling to remain the High Kings of Ireland at the time of the chronicle's writing. It was written during the rule of Muirchertach Ua Briain and was intended to draw a parallel with his famous ancestor.

There are similarities to a part of the Icelandic Njáls saga, which was composed in about 1280. In 1954, the scholar Einar Olafur Sveinsson postulated the incorporation into Njal's saga of a slightly earlier and lost thirteenth-century Icelandic saga, Brjáns saga ("Brian's Saga"). The relations between the accounts remains a matter of debate, and all the Icelandic written sources are considerably later than the chronicle.

The chronicler of Cogad Gáedel re Gallaib depicts the Vikings as vicious barbarians and suggests that the Dubliners are like their ancestors. In short, it may have been partly an attempt to "put the Dubliners in their place."

Modern scholars consider Cogad Gáedel re Gallaib to be a piece of "brilliant propaganda" written in a "bombastic style and full of patriotic hyperbole." Although the chronicle remains a valuable source of information about the Viking Age in Ireland, its accuracy is uncertain.

Comparable works include the earlier Fragmentary Annals of Ireland and the later Caithréim Chellacháin Chaisil.

It has been suggested that there may have been multiple versions of the Cogad circulating in the twelfth century.

Just as Cogad Gáedel re Gallaib drew on earlier annalistic sources, it was incorporated into later sources. Passages from Cogad were embedded in Geoffrey Keating's seventeenth century historical work Foras Feasa ar Éirinn; in turn, some of these sections were included in the work of James MacGeoghegan.

Structure and principal characters
The narrative of the Cogad begins with the arrival of the tyrannical Ivar of Limerick, this only after a long introduction, the "first part" is composed primarily of annalistic material.

The Munster section comprises a full quarter of the Cogad in total and a third of the narrative proper. The principal characters are:
 Ivar of Limerick
 Mathgamain mac Cennétig
 Brian Boru
 Máel Muad mac Brain, defeated and slain in the Battle of Belach Lechta
 Donnubán mac Cathail, defeated in the Battle of Cathair Cuan

The tale then introduces the Dal Cais clan and the sons of Cennedigh, Mathgambhain and Brian Boru.  The lives and politics of both brothers are outlined including their numerous interactions with the 'foreigners'.
Brian Boru's military aspirations are realised when he defeats the Ulaid of Aed O'Neill to gain control over Ulster. (LXXVII)
Brian Boru and his army defend Dublin against the invaders and drive them back into the sea. (CX)
Finally, Brian Boru dies at the hands of the Earl Brodar whom Brian manages to fatally wound. (CXIV)

Notes

Edition and translation

References and further reading

{{cite journal 
|last=Ní Mhaonaigh |first=Máire
|title=Some Middle Irish declensional patterns in Cogad Gáedel re Gallaib
|journal=Zeitschrift für celtische Philologie
|volume=49 |date=1997 |pages= 615–28 }}
Nic Ghiollamhaith, Aoife. "Dynastic warfare and historical writing in North Munster, 1276–1350." Cambridge Medieval Celtic Studies'' 2 (1981): 73–89.
 

Irish chronicles
12th-century history books
O'Brien dynasty
Medieval Irish-language texts
Irish-language manuscripts
Dalcassians
Uí Ímair