The Cantar de mio Cid (El Cid) recounts the heroic deeds of the Cid, an exiled member of the lower nobility who wins back his king's favor by battling the Islamic inhabitants of Spain. Based on the exploits of a historical personage, Rodrigo (Ruy) Diaz de Vivar, who lived from 1040-1099, this epic offers an important example of the interaction of history and literature in the Middle Ages.