"The term niyya does not occur in the Koran. The word ikhlas (sincerity) however is used 17 times in its active participial form, mukhlis, best appropriates the notion of worthy and well directed "intention" (niyya). Sincerity is the foundation of al acts of worship (2:139, 39:2, 11:14), acceptable to God and of all forms of prayer (7:29, 10:22, 29:65, 31:32, 40:14, 65, 98:5). The sincere servants of God are those whom He protects from being seduced by devil (15:40, 38:83) or from committing sins (12:24), they will all enjoy great happiness in hereafter (37:40,74, 128).
Niyya is a verb of nawa, meaning intention, aim or purpose in the doing of a thing, but it is wrongly supposed that the niyya consists in the repetition of certain words, stating that one intends to do so and so. Formulating the niyya or the expression of one's intention in set words, is unknown to the Koran and the hadith, and is in fact meaningless.
Every action of a human being must stem from his will, i.e. his choice for such action. A will is geared in its turn towards an act for a specific purpose, which is the intent. The meaning of intention, therefore, is the will directed towards the action, or the directing of the will towards the action. For illustration, if a person fires a shot at another with the intention of hitting him and does hit him, the perpetrator is said to have willed the action of firing and intended to hit the other person. Suffice it here to relate the classification as presented by al-Subki in al-Halabiyat (cf. Suyuti's al-Ashbah wa al-Nazair, Cairo, 1936, p. 25) while dealing with the commission of a sinful deed. According to this classification, intention is divided into five phrases. The first is al-hajis or the first impact of the intention upon the heart. The second is al-khatir where intent permeates the heart. The third is hadith al-nafs where a person oscillates between the thought of committing the act and that of refraining therefrom. The fourth is al-hamm where the intention to commit the act overshadows the thought of refraining therefrom. The fifth is al-azm where the intention is solidified by the will and the determination to implement the act.
Niyya is an inner intention or making up of mind to do anything and one gets the reward of his actions what he intended. It must be noted that while laying down a law, the Prophet primarily considered the value and spirit of the action and not the form of the action. Anas bin Malik relates that once the Prophet came into the mosque and beheld a chord stretched between the two columns (thereof), he asked "What is this?" He was replied that it was a chord which Zainab had set up, so that when she got tired by standing up long for prayer, she suspended herself thereby. The Prophet said, "Let one of you pray out of the vivacity of his heart, so long as he finds it pleasant, and when he gets tired, let him sit down" (Bukhari). During the last ten days of the month of Ramzan, the Prophet used to retire for prayer and meditation; whereupon Ai'sha asked leave to do the same, and the Prophet accorded her permission. She had a tent set up for the purpose. Hafsah heard of it, and had another tent set up. Zainab also had a tent set up. When in the morning the Prophet turned up, he saw the tents, and asked, "What is this?" Being told of that, the Prophet said, "Piety has not carried them to this. Pull them down, so that I may not see them again" (Ibid.).
The very first tradition with which Bukhari (23:1) opens his book is an example of what niyya means. "Actions shall be judged only by their aims" (innama-l-a'malu bil niyya). Hence if a good action is done with a bad aim, it shall not benefit the doer. According to a hadith al-kudsi, God says, "If My servant intends a good deed, then I count it for him as a good deed (even if) he does not carry it out. And if he does carry it out, then I count it for him as ten like unto it." (Masnad, 2:315)
Qadi Noman writes in Kitab al-Himma (pp.106-7) that, "If some one does a good deed and does it solely for the sake of God and for a reward from Him, he will be rewarded for it. But if he does it for the sake of show and acquiring a fame, his act will not be recognized as a pious deed. It will be an act of hypocrisy. The Prophet says,