Rodrigo Diaz de Vivar, known as "el Cid" or "el Cid Campeador" was a Castilian nobleman and military leader in Medieval Spain. He is a famous historical character and folk hero in Spanish culture.
El Cid lived during the years of Arab domination of the Iberian peninsula. His relationship with the Arabs was constantly changing, but mostly defined in utilitarian terms. At different points in time, el Cid, who after his exile from Castile became a mercenary, fought both for and against the Arabic people. He fought to defend the interests of the Muslim government of Zaragoza, and made significant conquests for them. However, he eventually came back to the service of his Christian king and fought the Almoravids, eventually defeating them in Valencia and ruling over Muslims and Christians alike.
Therefore, his relationship with them was based both on cooperation and competition, and it exemplifies a common pattern found in soldiers at the time in Spain.