Excavations in the 1990s demonstrated that the Rock was first settled in the 9th century when a hill fort or dún was constructed on the site. The first known settlement on the rock was Dun Masc, or Masc’s Fort, an early Christian settlement that was pillaged in 842 by the Vikings. In 845 the Vikings of Dublin attacked the site and the abbot of Terryglass, Aed son of Dub dá Chrích, was killed there. There is no clear evidence of 10th–11th century occupation. The castle was built in the second half of the 12th century. When the Normans arrived in Ireland in the late 12th century, Dunamase became the most important Hiberno-Norman fortification in Laois. It was Dunamase where Diarmuid MacMurrough, King of Leinster, brought the wife of O'Rourke, the King of Breifne, after kidnapping her. Enlisting the help of the O'Connor clan, the O'Rourkes and O'Connors drove MacMurrough from Dunamase and he fled Ireland. MacMurrough gave Dunamase and his daughter Aoife in marriage to the Norman conqueror Strongbow in 1170 as part of a deal to enlist his help to regain his lands. The Norman invasion of Ireland then followed when Strongbow accompanied MacMurrough, along with many men, to attack and regain MacMurrogh's lands. Later, with the marriage of Strongbow and Aoife's daughter and heir, Isabel, the castle passed into the hands of the Marshal family. William Marshal, who later became Regent of England in the minority of Henry III, had five sons, all of whom succeeded him in turn and died without issue. So in 1247 the Marshal lands were divided among William's five daughters. Dunamase fell to Eva Marshal and then to her daughter, Maud, who was married to Roger Mortimer. The castle remained in Mortimer hands until 1330 when another Roger Mortimer was executed for treason. By the time the Mortimer family was rehabilitated the castle seems to have passed out of the area under Norman control. It seems to have become a ruinous shell by 1350. But by the 16th century it was part of the land of the O'More family, and it is so memorialised in a 19th-century poem, Transplanted, by William O'Neill: But vain I wait and listen for Rory Og is dead, And in the halls of Dunamase a Saxon rules instead, And o'er his fruitful acres the stranger now is lord Where since the days of Cuchorb a proud O'Moore kept ward.
After the transplantation of the O'Mores to Kerry, their castle played no part in the Cromwellian wars. It was slighted in 1650 to prevent it being used. In the later 18th centurySir John Parnell started to build a banqueting hall within the ruins and this work incorporated medieval architectural details taken from other sites in the area.