the end of 966 and five year old Ramiro III (966–982) ascended to the throne of León. In the second year of his reign, 968, a Viking fleet of 100 ships landed in Galicia led by king Gunrod. The Vikings defeated the Galician forces, and killed Sisnando, the bishop of Compostela. The defeat in the Battle of Fornelos left Galicia without an authority capable of facing the Vikings, who for three years camped comfortably, looting different Galician regions. In 971, Gunrod and his Vikings were surprised and defeated by Count Gonzalo Sánchez upon return towards Ría de Ferrol (where they had their stranded ships). The Galician troops captured Gunrod and many of his warriors, executing them all. Sporadic Viking assaults continued in the north of Spain even into the 11th century. In 1008, Galicia and the Douro region were attacked, and in 1014 or 1015 a major raid was launched against the city of Tui at the mouth of the Minho River. The Vikings managed to successfully capture the bishop and many of the town's inhabitants. The Knýtlinga saga and Gesta Danorum describe another big raid after this one, in the year 1028. It was led by Ulv Galiciefarer, who tried to go to the Riá de Arousa area and then became a mercenary for Rodrigo Romániz, but was defeated by the bishop of Compostela. The last recorded raids occurred during the period 1047–1066 when Cresconius, the bishop of Compostela, fought and won several battles against the Vikings. Peak The Kingdom of León continued to be the most important of all those of the Iberian Peninsula. However, Sancho III of Navarre (1004–1035) took over Castile in the 1020s, and managed León in the last year of his life, leaving Galicia to temporary independence. In the division of lands which followed his death, his son Fernando succeeded to the county of Castile. Two years later, in 1037, he defeated the king of León who died in the battle and, because Fernando was married to the Leonese king's sister, he became king of León and Galicia. For nearly 30 years, until his death in 1065, he ruled over the kingdom of León and the county of Castile as Ferdinand I of León. Early in its existence, León lay directly to the north of the powerful Caliphate of Córdoba. When internal dissensions divided Al-Andalus' loyalties in the 11th century, leading to the age