In all such instances...
In all such instances, since the fellow who had made such a foolish and sinful intention, he did commit a sin of heart and hence has become liable to its punishment. Therefore, it is incumbent on him to repent.
Verses and Narrations It is mentioned in Surah Bani Israel: Surely the hearing and the sight and the heart, all of these, shall be questioned about that **.**[^1] It means that on the Day of Judgment, man will be asked: Why did you hear a thing the hearing of which was not allowed; why did you look at a scene which was prohibited; why did you intend to do a thing which was not permissible for you?[^2] In the opinion of Baidhawi and other scholars this verse shows that if a man makes an intention of doing a sinful thing he will be questioned about it.
Deeds will be questioned about, be they open or hidden The Lord of the worlds says in Surah Baqarah: …and whether you manifest what is in your minds or hide it, Allah will call you to account according to it… [^3] This holy verse has a wide-ranging scope, which includes man's beliefs, faculties and intentions. It means that be the belief and intention good or bad, if you have kept it in your heart and have decided to act upon it, Almighty God will surely ask you to account for it.
But as regards the thoughts coming to mind not accompanied by heart's intention, they will not be questioned as they were not intentional. Good intention too will be rewarded The author of Tafsir Majmaul Bayan says that man's intention is the only thing, which if intended by heart, and which man continues to entertain, will have to be accounted for. So it is understood that intention belongs to the heart's actions, which will be recompensed.
That is, if it is aggressive, punishment will be awarded but with a difference that an intention will attract a punishment only for that intention not for that bad deed which was not actually done. For example, if a man intends to kill someone but is not able to kill him, then the punishment will be only for entertaining that intention, not for murder, because the act of killing did not take place.
But in the matter of obeying Allah's Commandments, the reward will be for the exact act of obedience. This is mentioned in narrations. For example, a man who is waiting for the arrival of prayer time will be considered as in prayer. That is, he will be given the reward of performing prayer. But when that good deed is actually done, the performer will be given a tenfold reward.