Athafuns II, also known by the modern version of his name, Alfonso II, was King of Spain from 885 until his death in 910, and also Duke of Tarragona from 878 onwards. His paternal grandmother was a daughter of King Veremund I and, when the senior Wambid dynasty became extinct in 885 with the death of King Ramiro II, Athafuns was his closest living male relative and therefore had a good claim to the throne. Athafuns was elected king in July of that year and quickly set about securing the position of his new Tarragonese dynasty.
Athafuns is known for being the first Spanish king to convert to Islam. So far the religion had been relatively unknown in western Europe, due in no large part to the efforts of the Pope to block its spread, but the conversion of King Theodemar of Africa following his campaigns in the east enabled it to outflank Papal influence and opened up new routes of communication between east and west. Muslim missionaries began arriving in Spain as early as 870, and by 890 there were sizable communities flourishing all along the coast and in important cities. Athafuns was first exposed to Islam as a child, and publically converted in 888 after consolidating his rule.
For the rest of his reign he struggled against the resistance of the Church to follow suit, and Catholicism was restored as the state religion after his death. However, his legacy persisted as the Church of Spain refused to reenter communion with Rome, and the Muslim community only continued to grow over the years. The second, permanent conversion of Spain took place in 1115 under Queen Amalasuntha, and the country has remained predominantly Muslim ever since.