The origin of the cave as place of cult is controversial. It seems to have been originally another place of confluence of Pagan Cult as the Old EnglishWilweorthunga, meaning "well of worship" had been in Prehistorical times and still during the Roman Empire occupation. The Christian tradition has it that Pelagius, chasing a criminal, who had taken refuge in the cave, meets a hermit who was venerating the Virgin Mary. The hermit asked Pelagius to forgive the criminal, since the criminal had resorted to the protection of the Virgin, and says that one day that he too would need to seek shelter in the Cave. Muslim chronicles about the Battle of Covadonga say that in this cave Pelagius's forces fled, feeding on honey bees left in the crevices of the rock. Christian chronicles claim that the miraculous intervention of the Virgin Mary was crucial in the victory, repelling attacks against the cave. The first construction in the Holy Cave dates back of the reign of Alfonso I of Asturias, who, to commemorate the victory of Pelagius to the Muslims, built a chapel dedicated to the Virgin Mary, that would give rise to the invocation of the Our Lady of Covadonga. In addition to the altar dedicated to the Virgin built other two for Saint John the Baptist and Saint Andrew. Alfonso make delivery of this church to the Benedictine monks. The cave was covered with wood, and in 1777 a fire destroyed the medieval Marian statue. The current wooden image of Virgin and Child dates to the 16th century and was donated to the sanctuary by the Cathedral of Oviedo in 1778. During the civil war the Virgin image disappears and is found in the Embassy of Spain in France in 1939. The present chapel of Romanesque style is work of Luis Menéndez-Pidal and Alvarez.
Royal pantheon of Covadonga
The shrine of Covadonga was very important for the early Christian kingdom of Asturias. Members of the royal family buried in the Pantéon Real de Covadonga, were the following:
Queen Ermesinda. Alfonso I's wife, daughter of King Pelagius and Queen Gaudiosa, and sister of the King Favila of Asturias.
Pelagius died in Cangas de Onís, where he had his court in 737. After his death, his body was buried in the Church of Santa Eulalia of Abamia, located in the Asturian town of Abamia, where his wife had been also previously buried. The chronicler Ambrosio Morales noted in his work that Alfonso X the Wise, king of Castile and Leon, ordered to move the remains of Pelagius and his wife to the Holy Cave of Covadonga.