ibn Abi Iyad ibn Abd al-Haqq, Tasfin ibn Mu'ti, Musa ibn Rahhu, Abd al-Haqq ibn Rahhu, and Ibrahim ibn Yahya. Territorially, Muhammad consolidated his realm and gained several strongholds in the Kingdom of Jaén, including Quesada and Alcaudete. He lost Tarifa to Castile, and from this point the town would never again be in Muslim hands. The internal threat from the Banu Ashqilula was eliminated, and Muhammad not only saw off successfully the repeated Marinid attacks, but deprived them of their holdings in Al-Andalus as well. Muhammad oversaw a large-scale fortification project for the kingdom's defences, building a series of strategically positioned and well-supplied strongholds from the west to the east, which formed the backbone of Granadan frontier defences in the centuries to come. He worked with his own hands during the constructions of the moat (khandaq) in Alcaudete. The fortifications that he built also served to enforce royal authority because they were controlled by military governors (qa'ids) appointed and rotated by the court rather than by hereditary lords. They were often located in mountainous or other areas that were difficult to reach, and could only be conquered or breached by expensive siege warfare. Muhammad increased the importance of the vizier in the Nasrid state. He had only one vizier throughout his long reign, Abu Sultan Aziz ibn Ali ibn al-Mun'im al-Dani, who became his trusted ally. He also served as Muhammad's ambassador to the Marinids, commanded some military operations, and co-signed many royal documents. Muhammad also expanded the Alhambra, steadily establishing a royal residence zone in what was largely a fortress complex built by his father. He continued his father's constructions of a precinct wall surrounding the royal zone, as well as multiple residence buildings and bathhouses. The chronology for each part of the Alhambra during the early Nasrid period is not always clear—partly due to alterations and renovations under later Muslim or Christian rulers—but Muhammad II definitely built the original palace that today becomes the Convent of San Francisco as well as the original Dar al-Mamlaka al-Saida in the Generalife. He also built the Tower of the Ladies (Torre de las Damas, the site of today's Partal Palace built by his son Muhammad III) and the Tower of the Points (Torre de los Picos). Further afield, the Nasrid palace structure now known as the Cuarto Real de Santo Domingo, located on along the edge of what was Granada's