The Óbidos Castle was first built by the Moors during their occupation of Portugal starting in 713 AD. It was reclaimed by King Afonso Henriques in 1148. The Medieval citadel and its surrounding walls were then rebuilt and enhanced during the 13th, 14th and 20th centuries.