Military history of Ireland
The Vikings pillaged monasteries on Ireland's west coast in 795, and then spread out to cover the rest of the coastline. The north and east of the island were most affected. During the first 40 years, the raids were conducted by small, mobile Viking groups. From 830 on, the groups consisted of large fleets of Viking ships. From 840, the Vikings began establishing permanent bases at the coasts. Dublin was the most significant settlement in the long term. The Irish became accustomed to the Viking presence and culture and in many cases became allies, with intermarriage common throughout Ireland. A major Irish battle involving Vikings was fought at the Battle of Clontarf in 1014, in which a large force of Vikings and their Irish allies were defeated by the gathered Irish forces of Brian Boru, then the High King of Ireland along with a small contingent of Viking defectors. After this date Viking activity was sporadic with various Kings and nobles attempting to extend their power base. In 1099, Magnus Barefoot, the King of Norway, and his Viking army had successfully campaigned alongside their Irish allies against opposing Irish warbands. On his return his force was ambushed and killed on the north coast of Ireland.
Kingdom of Dublin
Vikings invaded the territory around Dublin in the 9th century, establishing the Norse Kingdom of Dublin, the earliest and longest-lasting Norse kingdom in Ireland. Its territory corresponded to most of present-day County Dublin. The Norse referred to the kingdom as "Dyflin", which is derived . The first reference to the Vikings comes from the "Annals of Ulster" and the first entry for 841 CE reads: "Pagans still on Lough Neagh". It is from this date onward that historians get references to ship fortresses or longphorts being established in Ireland. It may be safe to assume that the Vikings first over-wintered in 840–841 CE. The actual location of the longphort of Dublin is still a hotly debated issue. Norse rulers of Dublin were often co-kings, and occasionally also Kings of Jórvík in what is now Yorkshire. Under their rule, Dublin became the biggest slave port in Western Europe.