The praise to be found in the Qur'an for acts of the Companions that had already taken place can in no way be taken as proof for the justice of their conduct or their freedom from corruption and deviation throughout the entirety of their lives, It cannot be imagined that their deeds would always and under all circumstances be synonymous with justice and truth, for the pleasure of God Almighty and man's resulting attainment of eternal bliss are contingent on the maintenance of faith and consistently righteous behavior for the whole of one's life. If these two attributes are forfeited, the inevitable result will be deviation and corruption, with regard to both belief and action, and however brilliant be one's past, it will be utterly unable to secure one's eternal felicity.
The Most Noble Messenger, peace and blessings be upon him and his family, who instructed the whole of mankind in piety and the qualities of true humanity, who was the supreme monotheist and exemplar of moral virtues, who was never polluted with polytheism or sin even he was addressed thus in the Qur'an:
"If you assign partners to Almighty God, all your deeds will count for nothing and you will be among the losers" (39:65)
It is obvious that the Beloved Messenger, possessing as he did the quality of inerrancy, was not separated from God for even an instant. The purpose of this Qur'anic warning must then be to prevent the Muslims from falling prey to arrogance and their intentions from being polluted by hypocrisy. Every individual must exert himself to the utmost, drawing on all his powers and capacities, to the very last moment of his life, in order to earn the pleasure of his Lord, remaining firm and steadfast in his commitment.
The Qur'an says concerning that great prophet Ibrahim and his progeny: "If they tended to polytheism, their deeds would lose all validity." (6:88)
Likewise, the Qur'an also says: "God does not love the oppressors" (3:57) and "God is displeased with the wrongdoers." (9:96)
History makes it plain that by no means all of those who are known as Companions were in fact pious and righteous people. This can be deduced, for example, from a tradition of the Most Noble Messenger, peace and blessings be upon him and his family, recorded in the Sahih of al-Bukhari:
"On the Day of Resurrection I will be standing beside the pool of Kawthar, waiting for those who will come to me. I will see some of them separating and moving away from me, and I will ask, Are they not from among my Companions?' I will be told, 'Yes, but you do not know how they turned back to their previous ways after your death.' 
There is a comparable hadith in the Sahih of Muslim:
"People will come up to me beside the pool, in a manner visible to me. When they are brought before me, they will be ashamed. I will then say, 'O God, are these my Companions?' I will be told, 'You do not know what they did after your death.'" 
al-Taftazani, the well-known Shafi'i scholar, writes:
"The clashes, disagreements and battles that took place among the Companions have been recorded in books of history, and narrated by trustworthy authorities. It can therefore be deduced that some of the Companions must have deviated from the path of justice and truth and become polluted with oppression and wrongdoing. The reason for their deviation, wrongdoing, and oppression, was the feelings of hatred, obstinacy, and envy they nurtured, their hunger for leadership and rule, their addiction to pleasure and lust. It cannot be assumed that all the Companions were free of sin and impurity." 
If the followers of certain schools of thought in Islam do not have high regard for some of the Companions (ashab) or the followers (tabi'in) and criticize them in a number of respects, this cannot justify cursing them or calling their Islam into doubt. Competing views on this subject must not be allowed to degenerate into mutual hostile wrangling, and there is no justification for condemning as unbelievers any of the followers of the Messenger of God, peace and blessings be upon him and his family, for even some of the Companions themselves did argue with each other most vehemently. Thus at the Saqifah some called out for Sa'd b. 'Ubadah to be killed; Qays b. Sa' d b. 'Ubadah came to blows with 'Umar; and Zubayr declared that he would not return his sword to his sheath until everyone had sworn allegiance to 'Ali, whereupon 'Umar insulted him and called out for him to be seized, resulting in Zubayr's beating.
'Umar's behavior to Miqdad at the Saqifah, the way in which 'Uthman dealt with Ibn Mas'ud, Ammar b. Yasir and Abu Dharr al-Ghifari, as well as many other incidents, are all examples of the strife and disputation that took place. Differing views concerning certain of the Prophet's Companions cannot therefore serve as justification for cursing any Muslim or declaring him an unbeliever, nor can they be allowed to damage the unity of all Muslims.
In any event, the Sunnis themselves do not in practice regard all the Companions and Followers as worthy of respect. After all, those who killed 'Uthman were either from the Companions or from the Followers, and Khalid b. al-Walid killed Malik b. Nuwayrah, who was a Companion.
Among the Companions there were exalted personages who attained the utmost degree of faith, piety, and devotion, over whose hearts and souls God Almighty ruled; their whole beings resonated with purity and truthfulness. However, there were others in the corners of whose spirit still lurked the traces of Jahili customs and modes of thought; they remained attached to the customs of the past. There were even elements whose acceptance of Islam after the conquest of Makkah was based on the calculation of personal interest. However, the powerful influence and awe inspiring presence of the Prophet forced them to conceal their inner desires and inclinations, and it was only after his death that they were able to return to the habits and customs of the Jahiliyyah.
To approve undiscriminatingly the mode of conduct of all the Companions, to deny that any of them was guilty of evil deeds, and to assert that they were without exception persons of righteousness, is incompatible with the Sunnah of the Messenger of God, peace and blessings be upon him and his family.
One cannot therefore seek salvation among the Migrants and the Helpers or claim that he may gain eternal felicity by means of attachment to either of these groups. The attainment of that goal depends on the maintenance of certain conditions until one departs through death's gate.
Sunni scholars nonetheless maintain that all the Companions of the Prophet were entitled to exercize independent judgement (ijtihad) and are thus to be excused for whatever errors they may have committed, or even rewarded for them. Whatever offense they may have committed is thus justified. The triumph of this mode of thought made it impossible for any objection to be raised and emboldened certain egoistic and ambitious people to commit any crime they desired people like Mu'awiyah Amr b. al-'As, Khalid b. al-Walid, al-Mughirah, Sa'id al-'As, and Busr b. Abi Artat. Matters reached a point that Mu'awiyah had the temerity to proclaim: "All property belongs to God, and I am the representative of God; I will therefore dispose of it in whatever way I see fit." No one spoke out against him with the exception of Sa'sa'ah b. Suhan, one of the great figures of the Shi'ah; he refuted his claim. 
If to be numbered among the Companions of the Messenger of God was a guarantee of righteousness and salvation why did some of them even in his lifetime abandon their beliefs and join the ranks of the misguided, thereby earning condemnation and punishment by the Prophet?
Harqus. b. Zuhayr, the leader of the Kharijites at the battle of Nahrawan, was one of the Companions of the Messenger of God, and no one could imagine that toward the end of his life he would suddenly turn and fall prey to misguidance. Yet that is precisely what he did, a miserable ending that had been foreseen by the Prophet in these words: "He will abandon his religion just like an arrow drawn forth from the quiver." Not only did he join the Kharijites; at the battle of Nahrawan he was the standard bearer in rebellion against 'Ali b. Abi Talib, peace be upon him, by whose hand he was ultimately killed.
Abdullah b. Jahsh was another Companion who left behind the light of Islam. When he migrated to Abyssinia, it might have been expected that like the other Muslims who sought refuge in that land he would remain firm and steadfast in his beliefs and the defense of God's religion. Soon, however, darkness overtook his heart; he abandoned Islam and converted to Christianity.
We conclude then that God's expression of satisfaction with the Companions was conditional on their remaining within the bounds of faith and piety and maintaining their link with God to the very end of their life. If they changed direction and went astray, all of their good deeds were voided, and God Almighty's satisfaction became transformed into anger and wrath. Not only was no unconditional guarantee of God's permanent pleasure not given to the Companions or the common believers of later generations; it was not given even to the Prophets or the Imams, despite their whole beings overflowing with virtue and blessings for mankind.
 al-Bukhari, al-Sahih, "Kitab al-Fitan".
 Muslim, al-Sahih, Vol. XV, p. 64.
 al-Taftazani, Sharh al-Maqasid, p.46.
 al-Mas'udi, Muruj al-Dhahab.