Following Donnchad's deposition, Toirdelbach was one of Diarmait's key allies, particularly in Diarmait's final years when his authority was challenged within Leinster. In 1066 Diarmait and Toirdelbach each paid 30 ounces of gold to the king of Ciarraige Luachra of West Munster for his help in assassinating their enemies. In 1067 they campaigned together to defeat and kill the king of Ciarraige Luachra. Toirdelbach's nephew Murchad son of Donnchad was killed in 1068 while raiding in the midlands. The
Annals of Innisfallen record Toirdelbach as a lawmaker, reporting that in 1068: "A law and ordinance was made by Tairdelbach Ua Briain-and no better law was enacted in Mumu for a long time—with the result that neither cow nor horse was housed [at night] but allowed to wander at will." In the same year, and perhaps related to this law-making, Máel Ísu mac Amalgada,
comarba Pátraic or abbot of Armagh and successor of
Saint Patrick, visited Munster for the first time and received "his full visitation, both in tribute and offerings". Toirdelbach's ally and protector Diarmait mac Maíl na mBó faced increasing difficulties in his final years, difficulties which led Toirdelbach to intervene on Diarmait's behalf against his enemies in Leinster. Diarmait's sons Murchad and Glúniairn died in 1070, leaving the succession uncertain and disputed. Later in 1070 Toirdelbach took an army into Leinster, carrying off hostages, and receiving the submission of the king of Osraige. Toirdelbach had to return to Leinster again in 1071, when open warfare broke out between Diarmait's grandson Domnall, Murchad's son, and his nephew Donnchad, son of Domnall Remair. The annal states that the hostages Toirdelbach took were handed over into the keeping of Diarmait mac Maíl na mBó. Toirdelbach was not idle on his own account in these years. He led an army on a raid into the midlands in 1071, and had his soldiers build wooden bridges across the Shannon, evidently for military purposes, at
Áth Caille (perhaps modern
O'Briensbridge) and
Killaloe. Diarmait visited Munster in 1071, distributing gifts. Diarmait had earlier given Toirdelbach treasures which included Brian Bóruma's sword, and "the standard of the king of the Saxons". This was among Diarmait's last recorded acts before his death in battle on 7 February 1072. Toirdelbach was the chief beneficiary of Diarmait's death, the
Annals of Innisfallen recording that:Toirdelbach Ua Briain went to Osraige and Leinster, burned
Uí Cheinnselaig and brought away much booty and cows, and took hostages from it as well as from Leinster. And the foreigners gave him the kingship of
Dublin, and he made prisoner the sons of Domnall, son of Máel na mBó, in Dublin, and brought back the hostages of
Osraige on that occasion. Conchobar Ua Máel Shechnaill,
king of Mide, was murdered the next year, and Toirdelbach took advantage of this to ravage the midlands, followed by an expedition to Connacht where he obtained hostages from both the Uí Conchobair and the Uí Ruairc. He divided Leinster between various rivals, a policy of
divide and rule which would serve him well. In Dublin he installed one
Gofraid mac Amlaíb meic Ragnaill, perhaps a kinsman of Echmarcach, as his client king. A campaign in 1075 directed against the
Uí Néill and their allies in the north turned out less well. Toirdelbach's son
Muirchertach was defeated by the
Airgíalla near Áth Fhirdia (modern
Ardee,
County Louth) with heavy loss. At more or less the same time Gofraid was banished from Dublin by Toirdelbach, seemingly replaced by Domnall son of Murchad son of Diarmait mac Maíl na mBó, who ruled for only a short time before he died, and was replaced by Toirdelbach's son Muirchertach. With Muirchertach securely installed in Dublin, and another son, Diarmait, ruling over
Waterford, Toirdelbach was master of half of Ireland. ==The wider world==