Álvar Fáñez Álvar Fáñez ( or Háñez ) ( died 1114 ) was a Castilian nobleman and military leader under Alfonso VI of León and Castile , becoming nearly independent ruler of Toledo under Queen Urraca . He became the subject of legend , being transformed by the " Poema de Mio Cid " , Spain ' s national epic , into Álvar Fáñez Minaya , a loyal vassal and commander under Rodrigo Diaz de Vivar , El Cid , during the latter ' s exile and his conquest of Valencia . Family . Álvar derived from the same Castilian noble stock that produced El Cid and is called his " " sobrinus " " ( nephew or more general younger male kinsman ) in a contemporary document . He married Mayor Pérez , a daughter of count Pedro Ansúrez of the powerful Beni Gómez clan , and had by her ( it would seem ) two daughters : Eilo who married successively counts Rodrigo Fernández de Castro el Calvo and then in 1146 / 8 , as his third wife , Ramiro Fróilaz ; and Urraca , who married count Rodrigo Vélaz . Courtier and General . Álvar was at the royal court at least from 1076 ( the last time he and El Cid appear together ) . In 1086 , Alfonso sent Álvar to Valencia in order to place his candidate , al - Qadir , on the throne . This was accomplished with ease , although Fáñez would have to return when al - Qadir was besieged months later . Alfonso recalled Álvar ' s troops later that year to take part in what would be a defeat at the Battle of Sagrajas . In 1091 , he led a relief force that was defeated at Almodóvar . By the mid - 1090s , he had been placed in an essentially independent command of the eastern defenses of the Kingdom of Toledo , spanning from his father - in - law ' s military command at the city itself to that of his kinsman El Cid at Valencia . He also began to appear more frequently in royal documents . In 1097 , he joined Alfonso ' s army on the campaign that was to lead to a pair of defeats , of the main army under Alfonso near Consuegra , and of a flanking army under Fáñez in the Cuenca district . Two years later , he appears as Alcalde of Toledo . He was present in 1108 at the disastrous Battle of Uclés , escaping with a group of horsemen from an envelopment that claimed most of the Castilian army . Seven less fortunate counts and over a thousand men were killed or captured and beheaded , with the infante Sancho , the heir to the throne , being killed while trying to escape . Álvar fled north to organize the defenses along the Tagus . The next year he attended Queen Urraca on her succession , signing himself " dux toletule " ( Duke of Toledo ) . By mid - 1111 , he was , in effect , Toledo ' s ruler , and in 1113 he gave his consent ( as " toletani principis " ) to a royal donation there . As such he played a primary role in resisting the Murâbits . He also held Zorita , appearing in a donation as " Albar Fannez de Zorita " in early 1114 . Fáñez died in mid - April 1114 defending Urraca ' s rule against rebelling Segovia ns . " Poema de Mio Cid " . Álvar Fáñez , called Minaya , passed quickly into one of the heroic legends of the era , being a main character in " Poema de Mio Cid " . There , he is transformed from his historical role as loyal vassal and general of Alfonso VI to a similar role in the retinue of El Cid , often given military command when Cid splits his forces , and accompanying him during his exile , particularly in the campaign that made his uncle lord of Valencia ( this in spite of historical records that show he remained in the kingdom of Leon / Castile at the time ) and serving as his envoy to the royal court . He is a paragon of loyalty , not only being true to his uncle El Cid , but also unwavering in his defense of his kinsmen , El Cid ' s rivals , the " Infantes de Carrión " , a conflict perhaps based on the historical antagonism between El Cid and Álvar ' s father - in - law Pedro Ansúrez , uncle of the " Infantes " . Of particular note , he is credited with the reconquest of Guadalajara , Spain , where a Moorish tower , the " Torreón de Álvar Fáñez " , is named after him .