The former British prime minister said it was “the right time” for him to leave office.