There are many legends which purport to explain historical events, usually to justify the seizure of power by one powerful family or clan. This is particularly true with regard to the throne of Tara, and there are a number of stories designed to show that it was the destiny of the Ui Neill to be the dominant family in the land. That which follows is only one such tale.
One day the five sons of High King Echu Mugmeddon, Brian, Ailill, Fiachra, Fergus and Niall had been out hunting, and by evening were extremely thirsty. Searching for water, they found a well situated in a wood and approached to quench their thirst. To their dismay, they were confronted by the guardian of the well, a withered, extremely ugly, old hag, who demanded that she should be kissed as the price of drinking.
Brian, Ailill and Fergus were horrified and found the thought of kissing her repulsive and so held back. Fiachra summond up the courage to approach and give her a peck on the cheek, for which he was rewarded with a cup of water, insufficient for himself and his brothers. Niall, however, strode forward threw his arms round the hag and planted a kiss on her lips. Immediately, the rags fell away and the hag was transformd into a beautiful young girl: Erin the goddess of Ireland. She obliged Niall's brothers to kneel and swear loyalty to him and acknowledge his right to the sovereignty of Ireland, before allowing them to drink.
Thus, the High Kingship of Tara was conferred upon Niall and his posterity, the Ui Neill, although Fiachra was told that, as he had given a small peck to Erin, his descendants would similarly have a brief period as High Kings. This legend is an attempt to explain and justify the almost uninterrupted possession of the throne of Tara by the Ui Neill, with Daithi and Ailill Molt being the only High Kings to come from the UI Fiachrach (descendants of Fiachra). Interestingly, the last High King was Rory O'Connor (1198) who was descended from Brian, son of Echu Mugmeddon.
(Sources: S MacManus, Story of the Irish Race : E A D'Alton, History of Ireland )