The Castelo de Sintra o Castelo dos Mouros [Castle of the Moors] was conquered by Afonso Henriques in his approach to the siege and eventual conquest of Lisboa in 1147. It is located high above the city on a massive rock formation, difficult to access even today. The early history of the site includes pagan temples, including Greek and Galo-Celtic.
After its conquest, Afonso Henriques charged its inhabitants with the defense of the castle. In 1154, the repairs for its defense having been completed, the king provided its defenders with a charter and established of the Church of São Pedro de Canaferrim.