he began a campaign in the north against Ramiro II of Leon and Muhammad ibn Hashim al-Tujibi, the governor of Zaragoza. According to Ibn Hayyan, after inconclusively confronting al-Tujibi on the Ebro, Abd ar-Rahman briefly forced the Kingdom of Pamplona into submission, ravaged Castile and Alava, and met Ramiro II in an inconclusive battle. From 935 to 937, he confronted the Tujibids, defeating them in 937. In 939, Ramiro II defeated the combined Umayyad and Tujibid armies in the Battle of Simancas. Umayyad influence in western North Africa spread through diplomacy rather than conquest. The Umayyads sought out alliances with various Berber confederacies. These would declare loyalty to the Umayyad caliphate in opposition to the Fatimids. The Umayyads would send gifts, including embroidered silk ceremonial cloaks. During this time, mints in cities on the Moroccan coast—Fes, Sijilmasa, Sfax, and al-Nakur—occasionally issued coins with the names of Umayyad caliphs, showing the extent of Umayyad diplomatic influence. The text of a letter of friendship from a Berber leader to the Umayyad caliph has been preserved in the work of 'Isa al-Razi. During Abd ar-Rahman's reign, tensions increased between the three distinct components of the Muslim community in al-Andalus: Berbers, Saqaliba (European slaves), and those of Arab or mixed Arab and Gothic descent. Following Abd ar-Rahman's proclamation of the new Umayyad caliphate in Cordoba, the Umayyads placed a great emphasis on the Umayyad membership of the Quraysh tribe. This led to a fashion, in Cordoba, for claiming pure Arab ancestry as opposed to descent from freed slaves. Claims of descent from Visigothic noble families also became common. However, an "immediately detrimental consequence of this acute consciousness of ancestry was the revival of ethnic disparagement, directed in particular against the Berbers and the Saqaliba". When the Fatimids moved their capital to Egypt in 969, they left north Africa in charge of viceroys from the Zirid clan of Sanhaja Berbers, who were Fatimid loyalists and enemies of the Zenata. The Zirids in turn divided their territories, assigning some to the Hammadid branch of the family to govern. The Hammadids became independent in 1014, with their capital at Qal'at Beni-Hammad. With the withdrawal of the Fatimids to Egypt, however, the rivalry with the Umayyads decreased. Al-Hakam II sent Muhammad Ibn Abī ‘Āmir to north Africa in 973–974 to act as (chief justice) to the Berber groups that had accepted Umayyad authority. Ibn Abī ‘Āmir was treasurer