Ubaydah (may Allah have mercy on him) narrates from Sayyiduna Ali (may Allah be pleased with him) concerning the people of al-Nahr that he said: Among them there will be a man with a defective hand, on whose hand flesh will hang like a breast. Were it not that I fear you would become overjoyed (beyond bounds), I would tell you what (rank) the Prophet (peace and blessings be upon him) has stated for those who fight them. Ubaydah (may Allah have mercy on him) said: Did you hear this from the Prophet (peace and blessings be upon him)? He swore three times "By the Lord of the Ka'bah" and said: Yes.
Imam al-Shafi'i (may Allah have mercy on him) said: A group has denied (the legitimacy of) fighting rebels. They say: Rebels are people of disbelief and not Muslims, and fighting Muslims is not permissible, because the Prophet (peace and blessings be upon him) said: "The blood of a Muslim is not lawful except for three reasons: the apostate, the married adulterer and the killer." Apart from these, killing a Muslim in every other way is forbidden; therefore fighting them is also impermissible, because it would lead to killing them. Imam al-Shafi'i (may Allah have mercy on him) said: Their answer is that Allah Almighty and His Messenger (peace and blessings be upon him) have commanded fighting the rebellious group, and fighting is not the same as killing; it may be permissible to fight a Muslim while it is not permissible to kill him, just as it is permissible to wound and strike him while it is not permissible to kill him.
Then he continued his discussion until he said: Moreover, the Companions of the Messenger of Allah (peace and blessings be upon him) did not object to Sayyiduna Ali (may Allah be pleased with him) fighting the Khawarij; they objected to his fighting the people of Basrah and the people of Syria and disliked it, but they did not dislike what he did with the Khawarij.
The Shaykh (al-Bayhaqi) (may Allah have mercy on him) said: This is how Abu Abd al-Rahman al-Baghdadi narrated it from al-Shafi'i, and by it he meant some of the Companions, because they disliked fighting during the division. As for the Khawarij, we know of no one among them (the Companions) who disliked his stance towards them.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب قتال أهل البغي / 16784