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 .
Cuba and Puerto Rico still upheld the system of slavery .