A castellan is the title used in medieval Europe for an appointed official, a governor of a castle and its surrounding territory referred to as the castellany. The title of governor is retained in the English prison system, as a remnant of the medieval idea of the castellan as head of the local prison. The word stems from the Latin Castellanus, derived from castellum "castle". Sometimes also known as a constable of the castle district, the Constable of the Tower of London is, in fact, a form of castellan, with representative powers in the local or national assembly. A castellan was almost always male, but could occasionally be female, as when, in 1194, Beatrice of Bourbourg inherited her father's castellany of Bourbourg upon the death of her brother, Roger. Similarly, Agnes became the castellan of Harlech Castle upon the death of her husband John de Bonvillars in 1287. Initial functions After the fall of the Western Roman Empire, foreign tribes migrated into western Europe, causing strife. The answer to recurrent invasion was to create fortified areas which evolved into castles. Some military leaders gained control of several areas, each with a castle. The problem lay in exerting control and authority in each area when a leader could only be in one place at a time. To overcome this, they appointed castellans as their trusted vassals to manage a castle in exchange for obligations to the landlord, often a noble. In the 9th century, as fortifications improved and kings had difficulty making their subordinates pay their taxes or send the military aid they demanded, castellans grew in power, holding their fiefdoms without much concern for their overlord's demands. This changed as kings grew in power and as the Holy Roman Emperors replaced recalcitrant vassals with rival ministerial appointments. Duties Usually the duties of a castellan consisted of military responsibility for the castle's garrison, maintaining defences and protecting the castle's lands, combined with the legal administration of local lands and workers including the castle's domestic staff. The responsibility applied even where there was no resident castellan at the castle, or if he was frequently absent. A castellan could exercise the power of the "ban" – that is, to hear court cases and collect fines, taxes from residents, and muster local men for the defence of the area or the realm. There are similarities with a lord of the manor. Castellans had the