An improvised explosive thrown near anti-Islam protesters outside the New York mayor's residence was a viable device "that could have caused serious injury or death," police said Sunday.