In 1102, Alfonso VI sent troops to help Valencia against the Almoravid threat. The battle took place in Cullera and ended without a clear winner, although Valencia fell in Almoravid hands because for Alfonso, it was too expensive to defend this city. Alfonso VI supervised the evacuation of Valencia in March and April and set fire to it before leaving and, in May, the Almoravids took possession of it. 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.