Despite the death of Mathgamain, the Dál gCais remained a powerful force. Mathgamain was succeeded as King of Thomond by Brian, who quickly proved to be as fine a commander of armies as his brother was. After attacking and killing the much-weakened Ivar in the year 977, Brian pursued a new target, intending to eradicate the remaining Viking presence in Munster. Upon ascending to the throne, Imar, ruler or governor of the city of Limerick who was loyal to the now-slain Ivar, fled the city by ship down the River Shannon towards the Shannon estuary and took refuge in a monastery on Inis Cathaigh (Scattery Island), accompanied by his sons. However, in an act of revenge for the death of his brother, Brian set aside the sacred traditions and attacked the island with his troops, slaughtered the Vikings and desecrated the church.