Madrid 's most important remaining possessions were the island colonies of Cuba and Puerto Rico , both of which were chafing under the yoke of colonial rule and the bitter system of slavery .
Both Cuba and Puerto Rico had long since banished slavery at Madrid 's behest .