In 1501, Queen Isabella I of Castile, during her continuation of the Reconquista, decided that Gibraltar was too important to be left in private hands. She decreed it crown property—as her predecessor, Henry IV, had done around 40 years earlier—though apparently without resistance from house of de Guzmán.
After Isabella’s death in 1504 left her kingdom in turmoil, Juan Alfonso Pérez de Guzmán, 3rd Duke of Medina Sidonia decided to exploit the instability and gathered an army to march on Gibraltar. He hoped that the city would simply open its gates to him, but it did not, and so began an unenthusiastic siege.
After four months, the Archbishop of Seville persuaded the duke that it was dishonourable to continue the siege against the will of the inhabitants of Gibraltar, and the duke marched his army away, both sides having suffered minimal losses.
The siege was abandoned and the Castilian crown retained control of Gibraltar.