In 836, the Ostmen or Easterlings, by which name the Danes were then known, entered the Liffey in a fleet of sixty ships in aid of their countrymen, who had ravaged the land and even fixed themselves in some districts several years before. Dublin now submitted to them for the first time; and they secured themselves in the possession of it by the erection of a strong rath, which enabled them not only to overawe the city but to extend their power through Fingal, to the north, and to Bray and the Wicklow mountains to the south. The district from that time was the principal Danish settlement in Leinster ; Fin-Gal, to the north of the river, having acquired its name, as being the territory of the "White Strangers," or Norwegians; and the tract to the south being distinguished by the appellation of Dubh-Gal, or the territory of the "Black Strangers," from the Danes.
- But the invaders did not enjoy their newly gained acquisition in tranquillity. On the death of their king Tor-magnus or Turgesius, who, after having reigned despotically over a great part of the island for more than 40 years, was defeated and put to death, in 845, by Malachy, King of Ireland, the Danes were driven out of Dublin, and the city plundered by the Irish of Meath and Leinster. In the year following, however, they regained possession of it and secured themselves by adding new fortifications to those already constructed, and were still further strengthened by the arrival of Amlave, or Aulaffe, who, having landed in 853 with a powerful reinforcement of Danes and Norwegians, assumed the supreme authority over all the Danish settlers; and in the hope of enjoying quiet possession of his newly acquired dignity, he concluded a truce with the neighbouring Irish chieftains, but it continued only for three years.
- The annals of the remainder of this century are occupied with recitals of reciprocal attacks of the Irish and the foreigners, in which the one party failed to expel the invaders, and the other was equally unsuccessful in enlarging the bounds of their authority, or even of fixing it on a permanent basis in the capital of the district that acknowledged their sway: in one of those conflicts, Clondalkin, the favourite residence of Aulaffe, was burnt and upwards of one hundred of his principal followers were slain; in another he retaliated on the enemy, by plundering and burning the city of Armagh. So firmly did the Danish king feel himself fixed in his restored dominion, that he proceeded with his son Ivar, in a fleet of 200 vessels to aid his countrymen Hinguar and Hubba, then contending against the Saxons in the West of England, and returned next year laden with booty.
- On the death of Aulaffe, which took place the year following, his son Ivar succeeded him in the government of Dublin, where the opinion of his power was such that the Irish annals give him the title of King of the Normans of all Ireland. A few years after, the men of Dublin fitted out an expedition under the command of Ostin Mac Aulaffe against the Piets of North Britain, in which they were successful. Encouraged by these instances of good fortune, they again invaded South Wales, but were driven out with great loss ; to wipe off which disgrace they made an incursion into Anglesey, a few years after, and ravaged it with fire and sword. During all this period hostilities were carried on between them and the Irish with little intermission. The annals of the tenth-century state that Dublin was four times taken by the Irish, and the Danes expelled from it, but they invariably returned in strength sufficient to re-establish themselves, and often to retaliate severely on their enemies.
- This century is remarkable for other events connected with Dublin. Aulaffe Mac Godfrid, the king, was defeated in Northumberland by Athelstan, King of England; and about the middle of the century, the Ostmen of Dublin embraced Christianity. The first public proof of their conversion was the foundation of the monastery of the Blessed Virgin, near Ostmanstown, on the northern bank of the Liffey. About the same time, Edgar, King of England, is said to have subdued Wales, the Isle of Man, and part of Ireland, particularly the city of Dublin, of which mention is made in his charter dated at Gloucester, in 964.
- Towards the close of the century, the power of the Danes in this part of Ireland began to decline. In 980, they were defeated in a memorable battle at Taragh by Melaghlin, King of Ireland, who, following up his success, ravaged Fingal with fire and sword, and compelled the inhabitants of Dublin to pay a tribute of an ounce of gold for every capital messuage and garden in the city. Reginald, the Danish king, was so much affected by his losses that he undertook a pilgrimage to the Isle of Iona, where he died. The last year of the century was rendered still more memorable by the capture of Dublin by the celebrated Brian Boroimhe, King of Munster, who, after exacting hostages to secure his conquest, permitted the Danes to retain possession of it, a concession of which they immediately took advantage by strengthening it with several additional fortifications.
- Still, however, their power, though diminished, was not destroyed; for, in the commencement of the ensuing century, Brian Boru, in order effectually to crush them, found it necessary to form a confederacy of most of the subordinate kings of Ireland. The result was the celebrated battle of Clontarf, fought in 1014, in which the Danes were totally defeated, and the shattered remains of their army forced to shut themselves up in Dublin. But the triumph of the conquerors was diminished by the death of their leader, who received a mortal wound at the moment of victory: his son, a number of his nobles, and 11,000 of his soldiers shared his fate.
- The Danes still kept possession of the city. In 1038, Christ-Church was founded by Sitric the king, and by Donat, the first Danish bishop of Dublin; Aulaffe, Sitric's son, who succeeded him, fitted out a large fleet in order to reinstate Conan, the prince of North Wales, who had fled to Ireland to escape from the cruelties of Grufydd ab Llewelyn, an usurper, and had afterwards married Sitric's daughter. The expedition, though at first so successful as to have gained possession of Grufydd's person by stratagem, ultimately failed; for the Welsh, on hearing of his capture, assembled in great numbers, rescued Grufydd, and drove Conan and his Danish auxiliaries to their ships with great slaughter. A second expedition fitted out the ensuing year was equally unfortunate: the greater part of Conan's fleet was destroyed by a tempest and himself driven back on the Irish shore. He made no further attempt to regain his throne, but spent the remainder of his life with his father-in-law in Dublin.
- The city was soon after exposed to the assaults of a new enemy. In 1066, Godred Crovan, King of Man, obtained possession of it and overran a large portion of Leinster, over which he assumed the title of king, which he retained till his death, together with that of Man and of the Hebrides. On his demise the sovereign power again devolved on the Danes, who elected Godfrey Meranagh to succeed him.
- The Danes, though constantly exposed to the hostilities of the natives, against whom they had great difficulty in maintaining their position in the country, increased their difficulties by their internal dissensions. In 1088, those of Dublin besieged the city of Waterford, which was also inhabited by a colony of the same nation, entered it by storm and burnt it to the ground; and in the following year, the united Danish forces of Dublin, Wicklow, and Waterford proceeded to Cork with a similar intention, but were routed on their march thither and forced to return with considerable loss.
For some time after the district appears to have been subject to the kings of Ireland, as no mention is made of any Danish ruler there. At the same time, it appears that the kings of England endeavoured to obtain some influence in the affairs of Ireland, for it is stated that Rodolphus, Archbishop of Canterbury, by the orders of Hen. I., consecrated one Gregory Archbishop of Dublin, in 1121, and that this act was done with the concurrence of Turlogh O'Brien, then King of Ireland.
Afterwards, however, Dermod Mac Murchad, or Mac Murrough, King of Leinster, exercised paramount authority in the city. He founded the nunnery of St. Mary de Hogges, and the priory of Allhallows (All Hallows), both in its immediate vicinity, and, after overrunning all the surrounding country, forced the Danish residents there to acknowledge his supremacy, which he retained until the commencement of the reign of Roderic O'Conor, King of Ireland, who, on his attainment of the supreme monarchy, was recognised as King of Dublin by the inhabitants, and they in return received from him a present of four thousand oxen.