Carter took steps to help millions resettle in America, but it cost him politically