During the Battle of Ourique against the Moors in 1147, Afonso Henriques promised that if he won, he would build a magnificent monastery and church for the Cistercian Order of monks. Known as The Conqueror, Afonso I became the first king of Portugal. However, he would not live long enough to see the Monastery of St. Mary finished in 1223 and the church completed 29 years later.