Loja is a town in southern Spain situated at the western limit of the province of Granada. It is surrounded by the Sierra de Loja, of which the highest peak, Sierra Gorda, stands 1,671 metres above sea-level.
It is unknown when Loja was first captured by the Moors, however it is most likely in the 8th century. Its Moorish name was Medina Lawsa, and it was renamed to Loja when it was captured by the Christians in 1486, during the Reconquista. Isabella I of Castile called it the "flower among thorns".