 The same year, he undertook the repopulation of Salamanca —which protected Coria— and Ávila —which defended the mountain pass that was more accessible from Guadarrama—, trying to prepare for an eventual loss of Toledo.To protect the area from the east, in 1104 he laid siege and conquered Medinaceli, a key location from which the region of Toledo could be attacked from the east along the valley of the Jalón River.In 1104, 1105 and 1106, the king made several incursions in the Andalusian territory; reaching Málaga in 1106 and was able on his return to escort several Mozarabs who settled in his kingdom.