Fernando (or Fernán) Pérez de Traba (c.1090–1 November 1155), also Fernão Peres de Trava ( or ) in Portuguese, was a nobleman and count of the Kingdom of León who for a time held power over all Galicia. He became the lover of Countess Teresa of Portugal, through whom he attained great influence in that domain, and was the de facto ruler of the County of Portugal between 1121 and 1128. The Poema de Almería, a Latin poem celebrating one of Alfonso VII's major victories of the Reconquista, records that "if one were to see him [Fernán], one would judge him already a king." Family Fernán was the second son of Pedro Fróilaz de Traba, founder of the House of Traba, and his first wife, Urraca Fróilaz. His family was the most powerful in Galicia at the time, and he himself held properties in the most important Galician cities: Lugo and Santiago de Compostela. Fernán's first appearance in the surviving documentation dates from September 1107, just after the death of Raymond of Galicia, when his father confirmed a privilege of Alfonso VI for the monastery of Caaveiro, along with his sons. Early in the twelfth century (before 1125), Pedro gave his son a Moorish cook, probably a slave, with the Christian name Martin. Sometime early in the century Fernán took a wife, but they were separated when he became the lover of Theresa Alfónsez, Countess of Portugal. With Teresa he had two daughters: Sancha (born c. 1121), who married Álvaro Rodríguez, and Teresa, who first married Nuño Pérez de Lara and, when widowed, became the second wife of King Ferdinand II of León. Fernán's only attested wife, Sancha González, daughter of Gonzalo Ansúrez and Urraca Vermúdez, was therefore possibly his second wife. The earliest record of their marriage is from 1134. With her the count had three children: Gonzalo, María (married Ponce de Cabrera), and Urraca, the wife of Juan Arias. Sancha was still living on 24 July 1161, when she signed a document, noting that she was a widow. Probably in that same year she drew up her will. It is preserved, albeit with an incorrect date, in the cartulary Tumbo C of Santiago de Compostela, since the archbishop-elect of Santiago, Fernando Curialis, was a beneficiary. Relationship with the Archdiocese and the Crown In Galicia, Fernán rivalled for influence the archbishop Diego Gelmirez, with whom he kept an uneasy