The Banu Gómez (Beni Gómez) were a powerful but fractious noble family living on the Castilian marches of the Kingdom of León from the 10th to the 12th centuries. They rose to prominence in the 10th century as counts in Saldaña, Carrión and Liébana, and reached their apogee when, allied with Córdoba warlord, Almanzor, their head, García Gómez, expelled king Vermudo II of León and briefly ruled there. He would reconcile with the royal family, but launched two subsequent rebellions. On his death, the senior line of the family was eclipsed, but a younger branch would return to prominence, producing Pedro Ansúrez, one of the premier noblemen under king Alfonso VI and queen Urraca in the late 11th and early 12th centuries. The family would be portrayed in the Cantar de Mio Cid as rivals and antagonists of the hero, El Cid, and their rebellions would serve as a basis for the legend of Bernardo del Carpio.

Origin The first documented member of the Banu Gómez was Diego Muñoz, Count in Saldaña. Two competing theories have been proposed for his parentage. Diego's patronymic, indicating his father's name was Munio, along with the family's holding of lands around Liébana led Castilian historian Justo Pérez de Urbel to suggest that his parents were the Munio Diaz and wife Gulatrudia, who appear in the documentation of San Martin de Liébana (later Santo Toribio) from the year 914. Pérez de Urbel noted in particular a 929 diploma of the widowed Gulatrudia witnessed by her children, including a Diego Muñoz. However, the other named children were all daughters, conflicting with the known family of the Saldaña Diego Muñoz, which likely included two brothers. Further, Gulatrudia's son is still found in Liébana in 964, after the reported death of the count in Saldaña. Thus, contrary to the Pérez de Urbel theory, the Liébana and Saldaña men named Diego Muñoz appear to be distinct.

A second theory is now more generally accepted. It is based in part on the reasoning that for the family to be called Banu Gómez (descendants of Gómez) in Al-Andalus sources, there must have been a Gómez in their immediate ancestry when Diego's 932 rebellion attracted notice in Córdoba. This led to the hypothesis that Diego's father was the Munio Gómez (Munio, son of Gómez), who held land near San Román (Santibáñez de la Peña), one of the centers of power of Diego Muñoz and his descendants. This Munio Gómez also witnessed charters of the monastery of Sahagún in 915, while count Diego Muñoz would give lands to Sahagún in 922.

Following a 920 campaign of Abd-ar-Rahman III against León, king Ordoño II launched a punitive expedition targeting the Castilian counts in the lands around Carrión who had not turned up to fight. Among those he brought back in chains were Abolmundar Albo and his son Diego. Medievalist Margarita Torres Sevilla proposed the identification of this Diego with the future count of Saldaña, and thus Abolmundar Albo with Munio Gómez, and the use of the Arabic kunya Abu al-Mundhir (, father of 'the warner') for this man suggests that he may have spent time in Córdoba, perhaps following capture in battle. She further suggests that such a captivity might explain the later alliance between the Banu Gómez and Córdoba. Others dismiss this hypothesis, and instead identify Abolmundar Albo with a count Rodrigo Díaz, known to have had a son Diego.

Senior line

Diego Muñoz is the first well-documented member of the Banu Gómez, and it is under him that the family first are reported by Al-Andalus chroniclers. This was in reporting a rebellion launched in 932 by the Banu Gómez and Banu Ansur, supporting the deposed former-king Alfonso against his incumbent brother, Ramiro II. Though not explicitly named, the Banu Gómez leader would have been Diego Muñoz, joining the Count of Castile, Fernando Ansúrez in a raid into the Leonese plains, where they defeated the king's army, but the rebellion came to naught, as Ramiro was able to capture and blind Alfonso and other rivals. Diego had returned to loyalty by 934, when the Banu Gómez are said to have joined Ramiro in supporting the new Castilian count, Fernán González, against a campaign by Abd ar-Rahman III, and in 936 Diego and apparent brother Osorio Muñoz witnessed one of Ramiro's diplomas. The Banu Gómez again appear with the Banu Ansur in 941, joining the royal accord between Ramiro II and his allies, and Abd ar-Rahman III.

Diego Muñoz again rebelled. He disappears from royal diplomas from 940, and in 944 he and Fernán were imprisoned and deprived of their counties, but were released after swearing allegiance to the king, and he again appears as witness of royal grants, and he would be restored to his lands, appearing in 950 as Didacus Monnioz, come Saldanie (Diego Muñoz, count of Saldaña), and given a place of prominence, second only to Fernán González. He seems to have died in 951 or early 952. By his wife Tegridia, Diego had been father of sons Munio, Gómez, Osorio and Fernando Díaz, and daughters Elvira and Gontroda Díaz. Through the daughter Elvira, who married count Fernando Bermúdez of Cea, they would be grandparents of queen Jimena Fernández, wife of García Sánchez II of Pamplona. Three sons married the daughters of counts, illustrating the social standing of the family. Diego was succeeded in the county of Saldaña by his brother Gómez Muñoz, who is seen as count in 959 and 960, and on his death, his nephew Gómez Díaz, the son of Diego, followed.

Gómez Díaz first appears with his parents in 940, and in 946 he married Muniadomna, daughter of his father's ally, Fernán González of Castile. Like his father, he would be a close ally of the counts of Castile, and would marry two of his children to the children of count García Fernández of Castile. He likewise allied himself with the regent, Elvira Ramírez of León, during the reign of king Ramiro III of León, the boy king who would be married to another child of Gómez, his daughter Sancha Gómez. By 977 he would be ruling in Liébana, and apparently also in Carrión, in addition to Saldaña, and the same year, he sent an embassy to Caliph Al-Hakam II at Córdoba. He likely fought in the disastrous Battle of San Esteban de Gormaz, where a coalition of Christian forces organized by Elvira was soundly defeated, a loss that led the Galician nobility to elevate a competitor for the throne, Ramiro's cousin Bermudo Ordóñez. The Banu Gómez remained allies of Ramiro, controlling armies from their own lands and the Tierra de Campos. As such, Gómez found himself excluded from court when in 985 the Galician candidate proved successful, supplanting Ramiro and taking the crown of León as Bermudo II. The next year, when Almanzor launched a military campaign against León, the army passed through Banu Gómez lands unmolested, and perhaps even launched an attack on the capitol from Gómez's county of Carrión itself, an apparent indication of a Banu Gómez/Córdoba alliance. Gómez is last seen the next year acting with his brother Osorio Díaz, and it thought to have died in 987. He was succeeded by his son, García Gómez, having further children, counts Velasco, Sancho and Munio Gómez, queen Sancha, wife of Ramiro II, and apparently Urraca, wife of Sancho García of Castile.

García Gómez

Count García Gómez appears as count during his father's life, and came into his patrimony as the new king, Bermudo II, struggled to hold onto his crown in the face of rebellious nobility in the east and attacks from the Caliphate of Córdoba to the south. The year after his father's death, García initiated the first of his rebellions, calling himself elaborately proconsul dux eninentor in a 988 document, before being suppressed in early 989. He had married Muniadomna González, daughter of count Gonzalo Vermúdez, and when Almanzor again marched on León in 990, García and Gonzalo, and García's uncle Osorio Díaz joined him. Bermudo was forced to flee to Galicia. García would govern the eastern part of the kingdom, including the eponymous capitol, on Córdoba's behalf, referring to himself as 'ruling in León' in 990 (imperantem Garceani Gomiz in Legione). However, by mid-year the king regained the capitol and forced García to take refuge around Liébana. In 991, the king divorced his Galician wife, Velasquita, in favor of a new marriage to the daughter of the Count of Castile, García Fernández, leading to a new rebellion headed by her kin. Her sister was wife of Gonzalo Vermúdez and mother-in-law of García, and these two, along with count Pelayo Rodríguez and a junior member of the Banu Gómez, Munio Fernández would again force Bermudo to abandon León by 992, but the next year he again was able to return and suppress the rebellion.

Almanzor again attacked León in 995, but this time his army also sacked Carrión in retaliation for the withdrawal of García Gómez from an agreement to supply troops to the Córdoban army. García would again be at odds with Córdoba in 1000, when he and his brother-in-law Sancho García of Castile fought the Battle of Cervera against Almanzor. There a brother, apparently count Velasco Gómez, was killed. The deaths of Bermudo in 1000 and Almanzor in 1002 changed the political landscape, and the Banu Gómez were, at first, on friendly terms with the new child-monarch in León, and García, along with his brother count Sancho Gómez and uncle count Fernando Díaz signed a treaty with Almanzor's son Al-Muzzafar that included an agreement to supply troops. In 1005, García would incorporate Cea and Grajal into his territories, and amidst conflict with the Leonese king's guardian, count Menendo González, would claim the title 'count of León', implying another rebellion. In 1009, the Banu Gómez would support another son of Almanzor, Sanchuelo, in an unsuccessful attempt to reinstate him, and a member of the Banu Gómez would be killed with Sanchuelo in Córdoba. Historically, this has been identified with García, yet he appears in later documents so it must have been a different family member, perhaps his cousin, Fáfila Fernández or Sancho Gómez. He is last seen in 1015, and died within the next few years, the last 'great count' of the family. The possessions seem to have been dispersed among his brother, Munio Gómez, who held Liébana, having a childless marriage to a Banu Gómez kinswoman Elvira Fáfilaz, and her uncles, Munio Fernández, count in Astorga, and Diego Fernández, whose descendants would lead a resurgence of the family late in the century.

Junior lines The eventual heads of the family in succession to the senior line descended from count Fernando Díaz, a younger son of Diego Muñoz and Tegridia, who obtained lands in the Tierra de Campos through a marriage to Mansuara Fáfilaz, daughter of count Fáfila Oláliz. Some of these lands around Sahagún were reclaimed from his son Diego by king Alfonso V of León following the death of García Gómez. In addition to eldest son Diego, they were parents of Fáfila, Osorio and Munio. Count Fáfila Fernández was father of two known children, a daughter, Elvira, married to the last of the senior line of the family, Munio Gómez, and a poorly-documented son, Ordoño Fáfilaz. Munio Fernández would inherit the lands of his brother Osorio, and became count in Astorga, and a rebel collaborator of García Gómez.