The first Muslim campaigns that occupied the Iberian peninsula occurred between 711 and 715, with Coimbra capitulating to Musa bin Nusair in 714. Although it was not a large settlement, Qulumriyah (Arabic: قُلُمْرِيَة), in the context of Al-Andalus, was the largest agglomerated centre along the northern Tagus valley, and its principal city boasted a walled enclosure of 10 hectares, supporting between 3000 and 5000 inhabitants. Remnants of this period include the beginnings of the Almedina, Arrabalde and the fortified palace used by the city’s governor (which was later converted into the Royal Palace by the early Portuguese monarchs).
The Christian Reconquista forced Muslim forces to abandon the region temporarily. Successively the Moors retook the castle in 987–1064 and again in 1116, capturing two castles constructed to protect the territory: in Miranda da Beira (where the garrison was slaughtered) and in Santa Eulália (where the governor rendered his forces rather than facing a similar massacre).