The Partholonians were the first to invade Ireland, but the Fomorians killed them with a plague. Then came the Nemeds but they were enslaved. The third invasion was by the Firbolgs, who subdued the Fomorians, and the two races lived peacefully together.
This continued until the Irish gods, the Tuatha Dé Danann, arrived. They conquered the Firbolgs but in the Second Battle of Magh Tuiredh, the Fomorians were defeated. Attempting to guarantee peace, the Tuatha Dé promised to give the throne to one of the Fomorians, Bres, but he was deposed for his tyranny and replaced by Nuada of the Tuatha Dé.
The Fomorians were given Connacht and there was some intermarriage with the Tuatha Dé.