Meanwhile, Navarre lost all importance under King Sancho IV, for he lost Rioja to Sancho II of Castile, and nearly became the vassal of Aragon. At his death, the Navarrese chose as their king Sancho Ramírez, King of Aragon, who thus became Sancho V of Navarre and I of Aragon. Sancho Ramírez gained international recognition for Aragon, uniting it with Navarre and expanding the borders south, conquering "Wasqat" Huesca deep in the valleys in 1096 and building a fort, El Castellar, 25 km from "Saraqustat" Zaragoza.