A fortification existed in the region of Ourém since at least the period of Muslim domination. The area was reconquered by Christians in 1136, and the town was donated in 1178 by the first king of Portugal, Afonso Henriques, to his third daughter, Princess Theresa. The princess granted it a letter of feudal rights in 1180, to promote the settlement and development of the village. Under the Muslims, the village was apparently called Abdegas, but during the times of the Reconquista it was called Portus de Auren, from which the name Ourém was later derived. According to popular myth, the name of the village is actually derived from a Moorish Princess who converted to Christianity under the name of Oureana. The town's historical nucleus developed around the Castle of Ourém, which during the Reconquista served as watchpost for the Castle of Leiria, an important stronghold located nearby. In the mid-14th century, King Peter I turned Ourém and its lands into a County. The third Count of Ourém was the celebrated Nuno Álvares Pereira, the knight who led the Portuguese army to victory against the Castilians in the Battle of Aljubarrota in 1385. Under Count Afonso, fourth Count of Ourém, the town flourished. To accommodate his court, Count Afonso remodelled the old-fashioned castle and built a palace inside it following the trends in 15th-century Italian military architecture. The ruins of the palace and castle are the main historical and touristic attraction of the town nowadays. Count Afonso is buried in the crypt of the main church of Ourém in a magnificent Gothic tomb created by one of Portugal's main sculptors of the time, Diogo Pires-o-Velho. After reaching its peak in the 15th century, the town entered a period of relative decline. The town and castle were greatly damaged by the 1755 Lisbon earthquake and the Napoleonic Invasions. Until its elevation to the status of a city on August 16, 1991, Ourém was known as Vila Nova de Ourém.
Legend
The legend of the name of the village and Oureana is retold by Friar Bernardino de Brito in his Chronicle of the Order of Cister : In a surprise attack on the St John's Day in 1158, a Christian knight, Gonçalo Hermigues and his companions kidnapped a Moorish princess with the famous Arab name of Fatima. The knight took Fatima to a small village of the recently created Kingdom of Portugal, in the Serra de Aire hills. The princess fell in love with the Christian knight and decided to become herself a Christian, taking the name of Oureana. After their marriage, the princess received as prize the town which she called Ourém, derived from her own name. The name of the parish of Fátima of Ourém is probably related to this legend.
Parishes
Administratively, the municipality is divided into 13 civil parishes :