In 1462, Alonso de Arcos, alcaide of Tarifa, Rodrigo Ponce de León, son and heir of the Count of Arcos, and Juan Alonso de Guzmán, Duke of Medina Sidonia, attacked and gained control of the town of Gibraltar in the Eighth Siege of Gibraltar. Gibraltar belonged then to the Nasrid Kingdom of Granada and with this takeover, Gibraltar was no longer in Muslim hands. Upon arriving at Gibraltar, Alonso's forces attempted to storm the town, but the Nasrid soldiers stationed at the garrison were able to hold back his troops. In the midst of deciding what next to attempt, Alonso was delivered a message from the garrison requesting that the soldiers be allowed to peacefully evacuate the garrison with their belongings, surrendering it. Rodrigo Ponce de León, son of the second Count of Arcos, Alonso's overlord, arrived while Alonso was avoiding a direct answer to the garrison's request. Rodrigo did the same in order to wait until Juan Alonso de Guzmán arrived, though he thought to have his troops gain control of the city gates in the meantime. Upon landing, Juan was upset with Rodrigo, as he wanted to be the one to claim Gibraltar. However, Rodrigo also wanted the honor of doing so and, after arguing for a length of time, they decided to both plant their flags at the same time. Henry IV of Castile accepted the claim, naming himself "King of Gibraltar" and giving control of the town to Juan Alonso. Several years later, Beltrán de la Cueva, being a favorite of Henry IV, was given the post of Governor of Gibraltar. It was soon after that the War of the Castilian Succession began between Henry IV and his brother Alfonso, with Beltrán giving his support to Henry. Juan Alonso approached Alfonso in order to obtain an agreement that, if he sided with Alfonso against the king, he would be granted "lordship of Gibraltar, both city and fortress". The deal was agreed upon and it was for this reason that Juan Alonso sought to reclaim Gibraltar in April 1466 and began the Ninth Siege of Gibraltar.
Siege
The siege began, to the surprise of Esteban de Villacreces, the lieutenant of De la Cueva, and actual defender of the Gibraltar garrison, with a frontal assault in the middle of the day. Esteban sent messages to both Beltrán and Henry IV, requesting aid to support the garrison, but they could not divert any troops or supplies to the town. Instead, Esteban began gathering food, weapons, and soldiers from the people of Gibraltar to help resist Juan Alonso's assault. Juan Alonso, however, had already breached the town's walls by that time and Esteban was forced to retreat with his troops into the heavily fortified garrison, giving Juan Alonso control of the town as a whole. While Esteban had sufficient provisions for a time and enough weapons to hold off direct assaults, he also relied upon Beltrán or Henry IV eventually sending reinforcements so the town of Gibraltar could be retaken. Juan Alonso, however, used his troops and armaments to continually attack the garrison, the siege of which lasted sixteen months. During the siege, Juan Alonso obtained further troops and weapons and put his son, Enrique de Guzmán, in charge of them to continue the assault. The new supply of ammunition included several cannons that were used by Enrique to breach several of the garrison's walls. Esteban's soldiers attempted to cover the holes for a time, but a large assault eventually forced Esteban and his men to retreat to the innermost chamber of the garrison. This area was held for five months longer, even while Esteban's food supplies ran out and forced the men to eat the small amount of edible plants growing on the inner walls and the leather of their garments. But, after a number of his men defected to Enrique's side, Esteban eventually surrendered in June 1467 and the garrison was taken over.