The first documented history of Dublin begins with the Viking raids in the 8th and 9th century. These lead to the establishment of a settlement on the south side of the mouth of the Liffey, named Dubh Linn (Black Pool) after the dark tidal pool where the River Poddle enters the Liffey which is where the Danes first moor their boats.
The Vikings, or Ostmen as they call themselves, rule Dublin for almost three centuries, although they are expelled in 902 only to return in 917 and notwithstanding their defeat by the Irish High King Brian Boru at the Battle of Clontarf in 1014. From that date, the Norse are a minor political force in Ireland, firmly opting for a commercial life. Viking rule of Dublin ends completely in 1171 when the city is captured by King Dermot MacMurrough of Leinster, with the aid of Anglo-Norman mercenaries. An attempt is made by the last Norse King of Dublin, Ascall mac Ragnaill, to recapture the city with an army he raises among his relations in the Scottish Highlands, where he is forced to flee after the city is taken, but the attempted reconquest fails and Ascall is killed.
Dublin becomes the centre of English power in Ireland after the Norman invasion of the southern half of Ireland (Munster and Leinster) in 1169-1171, replacing Tara in Meath, seat of the Gaelic High Kings of Ireland, as the focal point of Ireland’s polity. On May 15, 1192 Dublin’s first written Charter of Liberties is granted by John, Lord of Ireland, and is addressed to all his “French, English, Irish and Welsh subjects and friends.” On June 15, 1229, his son Henry grants the citizens the right to elect a Mayor who is to be assisted by two provosts. By 1400, however, many of the Anglo-Norman conquerors are absorbed into the Gaelic culture, adopting the Irish language and customs, leaving only a small area of Leinster around Dublin, known as the Pale, under direct English control.