The Second Battle of Magh Tuiredh occurred due to a dispute over the kingship of the Tuatha Dé Danann. The major factions in the battle were the Tuatha Dé Danann, led by the reinstated Nuada, and the Fomorians, led by the deposed Bres.
In the aftermath of the First Battle of Magh Tuiredh, Bres, half-Fomorian (on his father's side) and half-Tuatha Dé Danann (on his mother's side) was elected High King of the Tuatha Dé Danann, because the previous king Nuada, had lost his hand during the battle and only an "unblemished" man could rule as High King.
However, Bres favoured his Fomorian kin and neglected his duties, forcing the Tuatha Dé Danann to work for the Fomorians. Duan Cecht, the physician god, replaced Nuada's hand and the Tuatha Dé Danann exiled Bres, re-electing Nuada.
Bres went to his father Elatha for aid, but was denied. He then went to Balor of the Evil Eye, another Fomorian leader, and successful in gaining aid, planned to lead the Fomorians against the Tuatha Dé Danann.
Lugh, half-Fomorian and half-Tuatha Dé Danann (and grandson of Balor) arrived at the court of Nuada and, proving his talent, was given command of the Tuatha Dé Danann army.
Battle and Aftermath
Balor uses his eye to destroy the armies of the Tuatha Dé Danann, killing Nuada, but Lugh uses a sling to knock the eye into the back of Balor's head, thus wreaking havoc on the Fomorian army. The Tuatha Dé Danann turn the tide and cause the Fomorians to flee, abandoning Bres who, having been found on the field by Lugh, is spared in order to teach the Tuatha Dé Danann about farming. Thus the Tuatha Dé Danann cement their rule over Ireland and free themselves from Fomorian oppression.