Kingdom of Asturias
When Alfonso II died, Ramiro I (842–50) staged a coup against the Count of the Palace Nepotian, who had taken the throne. After a battle on a bridge over the river Narcea, Nepotian was captured in flight, blinded and then forced into monastic life. Early in his reign, in 844, Ramiro was faced with a Viking attack at a place called Farum Brecantium, believed to be present-day Corunna. He gathered an army in Galicia and Asturias and defeated the Vikings, killing many of them and burning their ships. In 859, a second Viking fleet set out for Spain. The Vikings were slaughtered off the coast of Galicia by Count Pedro. The considerable territorial expansion of the Asturian kingdom under Alfonso III (866–910) was largely made possible by the collapse of Umayyad control over many parts of Al-Andalus at this time. Between the years 866 and 881, the western frontier of the kingdom in Galicia was expanded into the northern part of modern-day Portugal. The year 878 saw a Muslim assault on the towns of Astorga and León. The expedition consisted of two detachments, one of which was decisively defeated at Polvoraria on the river Orbigo, with an alleged loss of 13,000 men. In 881, Alfonso took the offensive, leading an army deep into the Lower March, crossing the Tagus River to approach Mérida. Then miles from the city the Asturian army crossed the Guadiana River and defeated the Umayyad army on "Monte Oxifer", allegedly leaving 15,000 Muslim soldiers killed. Returning home, Alfonso devoted himself to building the churches of Oviedo and constructing one or two more palaces for himself.