Population extinction and survival in a hostile environment