We shall restrict our discussion to the period of his somewhat more than four-year caliphate. 'Ali was all the time a two-powered personality; 'Ali always had the powers both of attraction and repulsion. In fact, we see right from the beginning of the Islamic age one group who gravitated more round 'Ali, and another group who did not have such a good connection with him and who were occasionally pained by his existence.
But the period of 'Ali's caliphate, and similarly the times after his death, that is to say the period of the appearance of the "history" of 'Ali, were the age of the greater manifestation of attraction to, and repulsion from, him; to the same extent as before the caliphate his links with the society were fewer, and also his attraction and repulsion less.
'Ali was a man who made enemies and gave people displeasure, and this, too, is another one of his great glories. Every principled man who has an aim and struggles towards it, particularly the revolutionary who pursues the putting into practice of his sacred goals and who is referred to by the words of Allah:
Who struggle in the way of Allah, not fearing the reproach of any reproacher. (5:54)
makes enemies and leaves dissatisfied people. So if his enemies did not number more than his friends, especially in his own times, they were no fewer and nor are they now.
If `Ali's personality were not distorted today, but were presented just as it was, many of those who pretend to be his friends would take a stand alongside his enemies.
The Prophet sent `Ali as a commander of an army to the Yemen. On his return he set out for Mecca to meet the Prophet, and, on reaching the environs of Mecca, he appointed one of the soldiers in his place and himself hurried on to present the account of his expedition to the Messenger of Allah. That person divided up the garments which `Ali had brought along with them among the soldiers, so that they could enter Mecca in new clothes. When `Ali returned, he objected to this action, and reproved that man for lack of discipline, because no decision should have been taken about the garments before orders had been received from the Prophet about what to do with them. In the eyes of `Ali, such an action was in fact a kind of expropriation from the baytu 'l-mal (the Treasury of the Muslims) without giving notification to, and obtaining permission from, the leader of the Muslims. For this reason `Ali gave the order that they should take off the garments and put them in a particular place, until they could be delivered to the Prophet and he himself could make a decision about them. Because of this, `Ali's soldiers became disgruntled, and, as soon as they had gone in to see the Prophet, they complained about `Ali's harshness over the garments. The Prophet addressed them, and said:
Oh men, do not grumble about 'Ali. I swear by Allah that he is more intensely in the way of God than that anyone should complain about him. (Ibn Ishaq, The Life of Muhammad (transl., A. Guillaume) p. 650.)
Ali had no concern for anyone in the way of God. Rather, if he showed interest in someone or was concerned about him, it was because of God. Naturally, such an attitude makes enemies, and it causes offence to souls full of greed and craving and brings them pain.
None of the companions of the Prophet had devoted friends like 'Ali did, just as no-one had such bold and dangerous enemies as he did. He was someone who, even after his death, had his corpse attacked by enemies. He was himself aware of this and foresaw these things, and so he left as his will that his grave should be hidden and unknown to all but his sons, until after about a century had passed and the Umayyids had been overthrown, the Khawarij overthrown too, or made all but impotent, and vendettas and avengers had become few, and Imam as-Sadiq indicated the sacred soil of his resting place.
In the period of his caliphate, `Ali expelled three groups from beside him and rose up to do battle with them: the people of (the battle of) Jamal, whom he himself named the Nakithun (those who break their allegiance); the people of (the battle of) Siffin, whom he called Qasitun (those who deviate); and the people of (the battle of) Nahrawan, the Khawarij, whom he called the Mariqun (those who miss the truth of the religion). 
When I took up the reins of government one party broke their allegiance (nakathah), another missed the truth of the religion (maraqah), and another deviated (qasatah). 
The Nakithun were of a money-worshipping mentality, people of covetousness and displayers of prejudice. `Ali's speeches about justice and equality were more for the attention of this group.
However the mind of the Qasitun belonged to politics, deception and sedition; they killed so as to take the reins of government into their own hands, and to topple the basis of 'Ali's government and his governorship. Some people advised him to come to a compromise with them and to give them, to a certain extent, what they were after, but he did not accept because he was not a person to do this kind of thing. He was ready to fight injustice, not to give his signature to it. On the one hand, Mu'awiyah and his clique were against the basis of 'Ali's government, and then the Qasitun wanted to occupy the seat of the caliphate of Islam themselves. In reality 'Ali's war with them was a war with sedition and double-dealing.
The third group, which was the Mariqun, had a spirit of inadmissible fanaticism, sanctimoniousness and dangerous ignorance. In relation to all these people, 'Ali was a powerful repeller and they lived in a state of non-conciliation.
One of the manifestations of 'Ali's completeness and his being a perfect individual was that, when it was called for, he faced the various factions and deviations and fought against all of them. Sometimes we see him on the scene, fighting with those who were devoted to money or to this world, and sometimes too on the scene fighting with professional politicians of the most hypocritical type, and sometimes with ignorant and deviationist men of false piety.
Our discussion is oriented towards the last group, the Khawarij. Although they have been overthrown and are no more, they present an instructive and admonitory little history. Their thinking has taken root among the Muslims, and consequently their spirit has always existed, and still does, in the shape of sanctimonious persons, all the way down these fourteen centuries, even though the individual Khawarij and even their name have disappeared, and they can be counted as a grave hindrance to the advancement of Islam and the Muslims.
 Before `Ali, the Prophet called these people by these names when he said to him: "After me, you will fight with the nakithun, the qasitun and the mariqun." This tradition is narrated by Ibn Abi'l Hadid in his commentary on Nahju 'l-balaghah (vol. 1, p.201), where he says that it is one of the proofs of the prophethood of Muhammad since the tradition is quite explicit about the future and the unknown (ghayb), and there is no kind of hidden interpretation or ellipsis in it.
 Nahju 'l-balaghah - Sermon 3 "ash-Shiqshiqiyah".