The legend tells that Don Teodosio, son of the lord of the palace of Goñi, one of the rich men of the country, married Doña Constanza de Butron y Vianda, noble of the region of Goñi.
In the year 707, under the reign of Witiza, Don Teodosio left for Africa to fight the Moors under the orders of the Don Julian count, according to some, and to defend Iruña (Pamplona) besieged by the Jews in coalition with the Moors, according to some. others.
Meanwhile, Doña Constanza had taken Don Teodosio's parents to his birthplace. On his return from the war, approaching his village, around Errotavidea (path to the mill) which leads to the valley of Ollo, a devil appeared to him disguised as a hermit, informing him that his wife was unfaithful to him with a servant, defiling his honor and that of his family.
Don Teodosio rushed back to his wife's house and, mistakenly, killed his own parents who were sleeping in his bed by piercing their breasts with his sword. As he left the house, he saw with surprise his wife coming out of the church and coming towards the house, happy with her husband's return. He saw his mistake.
The parricide confessed his fault that same evening to the parish priest of Goñi, Juan de Vergara, and then to the bishop of Pamplona, Martial, who ordered him to go to Rome on a pilgrimage to obtain the Pope's absolution. The latter, after having listened to the confession of the crime, sent him to do penance by wearing a large chain at his belt and carrying a cross on his back. When the chain breaks, he will have obtained forgiveness and should build, on the very spot, a church dedicated to the Archangel Saint Michael.
Being in the vicinity of Mount Ayedo, near Goñi, a link broke and there he built the hermitage of San Miguel de Ayedo which still exists. Seven years later, from a cave on Mount Aralar, a horrible dragon emerged with flaming eyes and a dangerous mouth. Faced with danger, Don Teodosio summoned San Miguel. At that moment, in the midst of a great thunder, appeared the archangel with a cross on his head. The dragon died and the chains cut, San Miguel left Don Teodosio a small image of wood. There he built a church where he retired with his wife. Here are venerated from the image of San Miguel and the chains of sacrifice.