Pedro Ruiz de Azagra was a Navarrese nobleman and soldier who established the independent Lordship of Albarracín, which lasted until 1284. He was the second son of Rodrigo Pérez de Azagra. His elder brother was Gonzalo Ruiz and his younger brother, later successor, was Fernán Ruiz. Pedro married Toda Pérez, the daughter of another Navarrese nobleman, Pedro de Arazuri. These two Pedros left Navarre about the same time, probably because they did not accept the succession of Sancho VI in 1154, after the death of his father, García Ramírez. He ended up in the service of Muhammad ibn Mardanis, ruler of the taifas of Valencia and Murcia. Between 1166 and 1168, Ibn Mardanis entrusted to him the lordship of Albarracín to defend his taifa's northern borders from the expansionist Alfonso II of Aragon. Pedro immediately began Christianising his lordship, refounding churches and erecting a bishopric. His refusal to recognise Aragonese sovereignty extended to his bishop, Martin, who refused to recognise the supremacy of the Bishop of Zaragoza, though ordered to do so by the pope. Pedro also colonised the region of Albarracín, mostly with settlers from Navarre. Pedro was generally on friendly terms with Navarre and with Alfonso VIII of Castile. In August 1170, he and his brother Gonzalo were part of an embassy sent by Alfonso VIII to meet his fiancée, Eleanor, in Bordeaux and conduct her back to him. Yet even when his father-in-law aligned with Castile, Pedro remained neutral. In 1172, Cerebrun, the Archbishop of Toledo in Castile and the primate of Spain, consecrated the bishop of Santa María de Albarracín and attached it to his diocese. In 1176, Pedro first called himself a "vassal of Saint Mary", a title to be employed by most of his successors, claiming no suzerain on Earth, only the Virgin Mary in heaven. A certain "Peire Rois" mentioned in the poem Quan vei pels vergiers despleiar, a sirventes by Bertran de Born, is probably Pedro. Composed probably in 1184, the song is Bertran's second anti-Aragonese screed. Pedro left no sons and was succeeded by his younger brother Fernán. He did leave behind a daughter, named Toda after her mother, and who married Diego López II de Haro and died on 16 January 1216.