As the Quran states...
As the Quran states: “…the (human) soul certainly incites evil, UNLESS my lord do bestow His Mercy…”(4) Clearly Almighty Allah has made an exception (by using the term “UNLESS”) to the human soul that incites evil. We can understand, based on Shi’ite philosophy, that the attachment of the soul (Nafs) to being is that of a relationship of control and administration. Therefore, the soul may incite evil; but the individual has the freedom and the authority to reject that invitation to evil.
If the individual accepts the invitation to evil, he becomes accountable for that evil which he commits. This is a very simplified explanation, but it serves the purpose. Now, the Prophets or the Messengers, are among the exception as Almighty Allah has indicated. That is, there is something in the soul of these virtuous humans that precludes the incitement of evil, and as such they never commit it. Their virtue is so high that they never even think of committing a sin.
It is not that if a Prophet or a Messenger wanted to commit a sin, he can’t; rather, it is that “Mercy,” mentioned in the above verse, that is bestowed upon him from Almighty Allah that precludes him from doing so. As such, he is sinless and infallible even though they have full ability of committing any kind of sin. When Satan refused to prostrate to Adam, He was driven away and became an accursed one.
Quran states that thereupon Satan said: He said: My Lord, Because You has sent me astray, verily I shall adorn the path of error for them on the earth, and shall deceive them all. Except those of them who are Your perfectly devoted Servants. (Allah) said: “This (Way of My sincere servants) is indeed a Way that leads straight to Me. Lo! as for My slaves, you have no way into them except the wrong-doers who follow you. And verily for all such people, hell is the promised place (5).
It is clear from the above conversation that Allah has promised that Satan has no way into His sincere Servants, and only wrong-doers will follow the Satan. Thus the Sincere Servants of Allah are not wrong-doers and shall not be deceived. Also Allah confirms that the Path of His Sincere Servants is a path which leads straight to Him. All these facts prove that the Sincere Servants of Allah never fall into the trap of Satan, and as such they are infallible, due to Allah’s Mercy.
One side remark here is that there is no mention of “Prophet” or “Messenger” in the above verses.