The great scholar al-Sa’di says in al-Fataawa al-Sa’diyyah (p. 228): Cancelling one’s intention with regard to acts of worship is of two types: one which does not have any effect, which is after the act of worship has been completed. … The second is cancelling the intention for the acts of worship when one is still doing it. … This means that the act of worship is not valid.
Does this mean that if it occurs to me to break an obligatory fast, my fast becomes invalid? What if that occurs to me but I do not form the intention to break my fast, is that o.k.? What is the ruling on that? Similarly in the case of wudoo’, if in the middle of it I begin to doubt whether there is some urine there, for example, then I do not find any. Sometimes I form the intention to stop doing wudoo’, then I go back and complete it after not finding anything. Should I start again from scratch because I stopped intending wudoo’ in this case?.
If a person forms the intention to stop doing an act of worship whilst he is doing it, it becomes invalid. No exception is made except in the case of Hajj and ‘umrah, which do not become invalid if the intention is cancelled or even if a person declares that he is going to stop. Rather the muhrim remains in ihraam until he has completed the rituals or he exits ihraam because of being prevented from continuing.
It says in al-Mughni (1/278): If he started his prayer with a sound intention, then he forms the intention to stop praying and exit from it, then it becomes invalid. This was the view of al-Shaafa’i. End quote.
It says in Zaad al-Mustanqi’ in the chapter on prayer: If he decides to end his prayer whilst praying or he becomes hesitant, then his prayer is invalidated. In the chapter on fasting he said: The one who forms the intention to break the fast has broken the fast.
But Shaykh Ibn ‘Uthaymeen (may Allaah have mercy on him) said in al-Sharh that hesitating about ending the prayer does not make the prayer invalid. See: al-Sharh al-Mumti’ (1/486). An example of hesitating is if he hears someone knocking at the door, and he wonders whether he should stop praying or carry on?
Thus it is clear that if a person decides to stop the act of worship, it becomes invalid, but if that was simply a thought that crossed his mind, it does not invalidate the act of worship.
Based on this, if the idea of stopping the fast simply occurs to one, it does not invalidate the fast until he decides and forms the intention to break the fast.
Similarly, if whilst doing wudoo’ he becomes uncertain as to whether urine has come out of him, and he pauses and looks, but does not intend to stop doing wudoo’, and he does not find anything, then his wudoo’ is not invalidated.
Similarly if he intends to stop doing wudoo’ his wudoo’ is invalidated, and it is not permissible for him to complete it, rather he must start all over again.
It says in al-Insaaf (1/151): If he cancels his intention whilst purifying himself, what he has already done is invalidated, according to the correct view. This was the view favoured by Ibn ‘Aqeel and by al-Majd in his commentary. And it was said that what has already been done is not invalidated thereby; this was stated by al-Musannaf in al-Mughni. End quote.
But one must beware of waswasah, because the shaytaan may come to a person and make him think that something has come out of him, and the person may get carried away with that and hardly be able to do any act of worship without doubting about it, which may cause him hardship and distress. Please see question no. 62839.
And Allaah knows best.