The Quran is very clear in its views on extremism:
Do not go to excess in your religion. (THE QURAN 4:171)
The same point has been made in a hadith. The Prophet of Islam said, “You should restrain yourselves from committing excesses (ghulu) in religion, for it was due to their having gone to extremes in religion that previous communities were destroyed.” (Musnad Ahmad, 1/215, 347)
Ghulu means extremism. The way of extremism is wrong, whatever the circumstances, because it goes against the spirit of religion. Extremism usually engenders attitudes that call for war and violence. Those who have extremist tendencies remain dissatisfied with the path of moderation, since it strikes them as being far from effective. That is why they so easily incline towards violence to achieve their objectives. Moderation, which is the opposite of extremism, is closely interlinked with peace. When people possess the virtue of moderation, they necessarily think in terms of peace and engage in their efforts in a peaceful manner.