In 912, Ordoño II ordered the repoblación of San Esteban de Gormaz as the city had been one of the borderline cities in between the Moorish and Christian zones of the Iberian Peninsula.
This region had become depopulated early in the Muslim takeover and acted as a buffer zone between the two groups.
Ordoño II was able to successfully come to the city's aid and routed the Muslim forces.
His head was put on display on the city's ramparts as a warning to the Muslims.
The city changed hands several times until 1054 when the town was permanently retaken by the Christian forces under the command of Rodrigo Diaz de Vivar, also known as el Cid.