Over the centuries the cathedral of Leon has undergone successive restorations in which a number of famous architects have participated. Ordoño II built the temple on the site of his royal palace as a show of gratitude for defeating the Moors at the battle of San Esteban de Gormaz.
http://www.spain.info/en_IN/que-quieres/arte/monumentos/leon/catedral_de_leon.html