At the end of the eighth siege, Juan Alonso de Guzmán took control of Gibraltar after a bitter dispute with Alonso Ponce de Leon, but shortly after, King Henry IV of Castile declared Gibraltar crown property, likely at the behest of the Ponce de Leons.
When the Castilian nobles and clergy deposed Henry and declared his half brother Alfonso king, Juan quickly pledged his loyalty to Alfonso in return for a royal warrant granting Gibraltar to the house of de Guzmán, and Juan launched the ninth siege.
The governor of Gibraltar almost immediately retreated into the Moorish Castle, which Juan blockaded in the expectation that the governor would shortly surrender. Ten months later, however, the governor was still barricaded inside the castle, so Juan brought in cannon to breach the walls and stormed the castle, forcing the defenders to retreat to the Tower of Homage (the innermost chamber of the castle). The defenders remained inside the tower hoping for rescue, but finally surrendered when none came after a further five months.
The De Guzmán family resumed control of Gibraltar.