Section
Refraining from an act for a specified period requires an intention, unlike refraining without a specified period, because refraining is, in either case, an action of the heart, as shown by the fact that it can be commanded. Do you not see that one says, โRefrain from such-and-such,โ just as one says, โDo such-and-suchโ? When it is confined to a specified period with a defined beginning and end, an intention is required at its beginning, as with other acts of worship. The Prophet (may Allah bless him and grant him peace) said: โWhoever does not resolve during the night to fast has no fast.โ This is because intention means devoting the action sincerely to Allah, since it may be performed for someone or something other than Him. A person may, for example, intend to fast for his own benefit as a medical treatment, yet receive no reward for it, since he has not fasted for Allah but for himself. He is thus fasting for a particular purpose, not as an act of religious observance. When refraining is not confined to a specified period, however, it has no defined beginning or end, so an intention is not required, since no particular time is assigned to it. Nor is there any reward for such refraining: the person is punished for committing the act but is not rewarded for refraining from it.
Section
There is consensus that the intention to fast may be formed before beginning the fast and embarking upon it, because the Messenger of Allah (may Allah bless him and grant him peace) said: โWhoever does not resolve during the night to fast has no fast,โ without distinguishing between the beginning and the end of the night. It has been said that fasting differs from prayer in this respect because forming the intention to fast at the very instant dawn breaks is difficult. Requiring people to do so would impose hardship in religion, which Allah Most High has removed from His servants by saying:
โHe has not placed upon you any hardship in religion.โ [al-Hajj: 78]
Yet this does not establish a distinction between the two cases. If an intention formed before dawn were of no effect in fasting, it would have to be formed at the very moment of dawn, even though that entails hardship, since an action without an intention is of no benefit. In my view, therefore, there is no impediment to drawing an analogy between prayer and fasting to allow the intention to precede the beginning of prayer. Scholars unanimously agree that this is permissible in fasting, and an established Sunnah from the Prophet (may Allah bless him and grant him peace) supports it. Fasting is thus a foundational case to which prayer, concerning which there is disagreement, must be referred, just as the rulings on the ritual bath and ablution have been referred to it. Accordingly, an intention may precede the beginning of prayer to the same extent that this has been permitted for the ritual bath and ablution by analogy with fasting.