Historical sources do not explain the precise role of Marvão castle itself within the 50-year statelet, or wilāya - established from 884 to 930 - controlled by Ibn Marwán, his son, grandson and great-grandson from Badajoz. While the territory of the Banu Marwan was extensive, covering much of modern-day Portugal and Extremadura, its autonomy within the Cordoban Emirate was precarious.