The British prime minister is facing a fresh threat to his leadership following Labour’s crushing local election losses.