The warning comes after the prime minister said some prisoners serving indefinite sentences could be freed to increase prison capacity.