It was a politically foolish but correct statement.
Not only politically foolish, but tactically and strategically foolish as well.
Right now, some Muslim countries (like Turkey) are more-or-less on our side, and many other Muslim nations, from North Africa to Southeast Asia, are at least not actively fighting against us. If we were to explicitly frame this as a U.S. vs. Islam war, we would be in a heap more of trouble than we are now.