In 1080 Alfonso VI released Toledo and neighboring settlements including Madrid from moors. In XI - XIV Madrid represents a small Castilian city which has grown around of the Arabian fortress. The castle of Gabsburg was under construction in XV century on a place of the Arabian fortress. Kings sometimes stayed there in travel. The population of city does not exceeded 20 thousand person at this time.

