 As a respected monk, Ramiro was elected abbot of the Castillian royal monastery of Santos Fecundo y Primitivo in Sahagún and later was abbot of the monastery of San Pedro el Viejo at Huesca.Wanting to limit Ramiro's power within the Kingdom of Navarre-Aragon, his brother Alfonso the Battler had blocked his elections as bishop of Burgos and as bishop of Pamplona.In 1134 Ramiro had been elected bishop of Barbastro-Roda when the death of his childless brother made him one of the candidates for succession to the crown.