Muiredach mac Brain was a King of Leinster of the Uí Dúnchada sept of the Uí Dúnlainge branch of the Laigin. This sept had their royal seat at Líamhain. He was the son of Bran mac Fáeláin and brother of Ruarc mac Brain, previous kings. There is much confusion in the king lists during this period for Leinster. Francis John Byrne suggests that the root of this apparent confusion lay in the fact that the Uí Dúnlainge kings exercised little real authority due to the aggressions of their western neighbour Cerball mac Dúnlainge, King of Osraige. Cerball, while unable to install himself as king of Leinster, was able to prevent any rival king exercising real power there. Muiredach himself appears in the annals as leader of Leinster forces and King of Leinster at a time when others were considered to be king. His first appearance in the annals is in the year 870. In that year, the high kingÁed Findliath invaded Leinster and overran it. Meanwhile his ally Cerball mac Dúnlainge of Osraige invaded Leinster from the west. He reached Dún Bolg where his camp was attacked by the Laigin who were at first successful, but in a counter-attack they were put to flight. Muiredach is named as leader of the Leinster forces and as king. The resistance was enough to prevent the high king from taking the hostages of Leinster. In 871 the king Ailill mac Dúnlainge was slain by the Vikings of Dublin. The annals then claim that Domnall mac Muirecáin became king in 880. In the intervening period, Áed Findliath invaded Leinster in an attempt to impose his authority and he plundered the country and burned churches including Cell Ausili in 874. Muiredach retaliated and led a force to attack the lands of the southern Ui Neill in 875. He laid waste the country as far as Sliab Monduirn in Brega. Domnall died in 884 and Muiredach became definitely king. He is acknowledged King of Leinster at his death notice in 885 in the annals. Muiredach was also abbot of Kildare where he succeeded his kinsman Cobthach mac Muiredaig in 870. This abbacy had been a virtual monopoly of the Uí Dúnchada sept since 798. Another kinsman, Suibne Ua Fínsnechtai was Bishop of Kildare from 875-881. His son Faelán mac Muiredaig was also a King of Leinster.